diff --git a/Makefile b/Makefile index 5175cf2..3e75c19 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/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -41,7 +41,7 @@ ENABLE_S5_KEEP_CURR_MAC = n ENABLE_EEE = y ENABLE_S0_MAGIC_PACKET = n ENABLE_TX_NO_CLOSE = y -ENABLE_MULTIPLE_TX_QUEUE = n +ENABLE_MULTIPLE_TX_QUEUE = y ENABLE_PTP_SUPPORT = n ENABLE_PTP_MASTER_MODE = n ENABLE_RSS_SUPPORT = n @@ -54,25 +54,25 @@ ENABLE_PAGE_REUSE = n ENABLE_RX_PACKET_FRAGMENT = n ifneq ($(KERNELRELEASE),) - obj-m := r8125.o - r8125-objs := r8125_n.o rtl_eeprom.o rtltool.o + obj-m := r8126.o + r8126-objs := r8126_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 + r8126-objs += r8126_realwow.o EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT endif ifeq ($(ENABLE_DASH_SUPPORT), y) - r8125-objs += r8125_dash.o + r8126-objs += r8126_dash.o EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT endif ifeq ($(ENABLE_DASH_PRINTER_SUPPORT), y) - r8125-objs += r8125_dash.o + r8126-objs += r8126_dash.o EXTRA_CFLAGS += -DENABLE_DASH_SUPPORT -DENABLE_DASH_PRINTER_SUPPORT endif - EXTRA_CFLAGS += -DCONFIG_R8125_NAPI - EXTRA_CFLAGS += -DCONFIG_R8125_VLAN + EXTRA_CFLAGS += -DCONFIG_R8126_NAPI + EXTRA_CFLAGS += -DCONFIG_R8126_VLAN ifeq ($(CONFIG_DOWN_SPEED_100), y) EXTRA_CFLAGS += -DCONFIG_DOWN_SPEED_100 endif @@ -98,22 +98,22 @@ ifneq ($(KERNELRELEASE),) EXTRA_CFLAGS += -DENABLE_MULTIPLE_TX_QUEUE endif ifeq ($(ENABLE_PTP_SUPPORT), y) - r8125-objs += r8125_ptp.o + r8126-objs += r8126_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 + r8126-objs += r8126_rss.o EXTRA_CFLAGS += -DENABLE_RSS_SUPPORT endif ifeq ($(ENABLE_LIB_SUPPORT), y) - r8125-objs += r8125_lib.o + r8126-objs += r8126_lib.o EXTRA_CFLAGS += -DENABLE_LIB_SUPPORT endif ifeq ($(ENABLE_USE_FIRMWARE_FILE), y) - r8125-objs += r8125_firmware.o + r8126-objs += r8126_firmware.o EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE endif ifeq ($(DISABLE_WOL_SUPPORT), y) diff --git a/Makefile_linux24x b/Makefile_linux24x index cfd82ba..244bb08 100644 --- a/Makefile_linux24x +++ b/Makefile_linux24x @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -46,7 +46,7 @@ endif MODCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall MODCFLAGS += -I$(KSRC)/include -I. MODCFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h -SOURCE := r8125_n.c rtl_eeprom.c rtltool.c +SOURCE := r8126_n.c rtl_eeprom.c rtltool.c OBJS := $(SOURCE:.c=.o) @@ -62,8 +62,8 @@ ifeq ($(SMP),1) endif modules: $(OBJS) - $(LD) -r $^ -o r8125.o - strip --strip-debug r8125.o + $(LD) -r $^ -o r8126.o + strip --strip-debug r8126.o %.o: %.c $(CC) $(MODCFLAGS) -c $< -o $@ @@ -72,4 +72,4 @@ clean: rm *.o -f install: - install -m 744 -c r8125.o $(KMISC) + install -m 744 -c r8126.o $(KMISC) diff --git a/r8125.h b/r8126.h similarity index 87% rename from r8125.h rename to r8126.h index 77f1a0c..9c66f24 100644 --- a/r8125.h +++ b/r8126.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,19 +32,23 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ -#ifndef __R8125_H -#define __R8125_H +#ifndef __R8126_H +#define __R8126_H //#include #include #include #include -#include "r8125_dash.h" -#include "r8125_realwow.h" -#include "r8125_ptp.h" -#include "r8125_rss.h" +#include "r8126_dash.h" +#include "r8126_realwow.h" +#include "r8126_ptp.h" +#include "r8126_rss.h" #ifdef ENABLE_LIB_SUPPORT -#include "r8125_lib.h" +#include "r8126_lib.h" +#endif + +#ifndef fallthrough +#define fallthrough #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) @@ -229,18 +233,18 @@ 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 +#define R8126_USE_NAPI_ALLOC_SKB 0 +#ifdef CONFIG_R8126_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 +#undef R8126_USE_NAPI_ALLOC_SKB +#define R8126_USE_NAPI_ALLOC_SKB 1 #endif #endif #define RTL_BUILD_SKB_INTR(data, frag_size) build_skb(data, frag_size) -#ifdef CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_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) @@ -266,11 +270,11 @@ do { \ #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) -#define ENABLE_R8125_PROCFS +#define ENABLE_R8126_PROCFS #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) -#define ENABLE_R8125_SYSFS +#define ENABLE_R8126_SYSFS #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) @@ -380,28 +384,36 @@ do { \ #define MDIO_EEE_1000T 0x0004 #endif +#ifndef MDIO_EEE_2_5GT +#define MDIO_EEE_2_5GT 0x0001 +#endif + +#ifndef MDIO_EEE_5GT +#define MDIO_EEE_5GT 0x0002 +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) #ifdef CONFIG_NET_POLL_CONTROLLER -#define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8125_netpoll +#define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8126_netpoll #else #define RTL_NET_POLL_CONTROLLER #endif -#ifdef CONFIG_R8125_VLAN -#define RTL_SET_VLAN dev->vlan_rx_register=rtl8125_vlan_rx_register +#ifdef CONFIG_R8126_VLAN +#define RTL_SET_VLAN dev->vlan_rx_register=rtl8126_vlan_rx_register #else #define RTL_SET_VLAN #endif -#define RTL_NET_DEVICE_OPS(ops) dev->open=rtl8125_open; \ - dev->hard_start_xmit=rtl8125_start_xmit; \ - dev->get_stats=rtl8125_get_stats; \ - dev->stop=rtl8125_close; \ - dev->tx_timeout=rtl8125_tx_timeout; \ - dev->set_multicast_list=rtl8125_set_rx_mode; \ - dev->change_mtu=rtl8125_change_mtu; \ - dev->set_mac_address=rtl8125_set_mac_address; \ - dev->do_ioctl=rtl8125_do_ioctl; \ +#define RTL_NET_DEVICE_OPS(ops) dev->open=rtl8126_open; \ + dev->hard_start_xmit=rtl8126_start_xmit; \ + dev->get_stats=rtl8126_get_stats; \ + dev->stop=rtl8126_close; \ + dev->tx_timeout=rtl8126_tx_timeout; \ + dev->set_multicast_list=rtl8126_set_rx_mode; \ + dev->change_mtu=rtl8126_change_mtu; \ + dev->set_mac_address=rtl8126_set_mac_address; \ + dev->do_ioctl=rtl8126_do_ioctl; \ RTL_NET_POLL_CONTROLLER; \ RTL_SET_VLAN; #else @@ -431,9 +443,9 @@ do { \ #ifndef NET_IP_ALIGN #define NET_IP_ALIGN 2 #endif -#define R8125_RX_ALIGN NET_IP_ALIGN +#define R8126_RX_ALIGN NET_IP_ALIGN -#ifdef CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI #define NAPI_SUFFIX "-NAPI" #else #define NAPI_SUFFIX "" @@ -464,16 +476,16 @@ do { \ #define RSS_SUFFIX "" #endif -#define RTL8125_VERSION "9.012.04" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX -#define MODULENAME "r8125" +#define RTL8126_VERSION "10.013.00" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX +#define MODULENAME "r8126" #define PFX MODULENAME ": " #define GPL_CLAIM "\ -r8125 Copyright (C) 2023 Realtek NIC software team \n \ +r8126 Copyright (C) 2024 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 +#ifdef RTL8126_DEBUG #define assert(expr) \ if(!(expr)) { \ printk( "Assertion failed! %s,%s,%s,line=%d\n", \ @@ -483,17 +495,17 @@ This is free software, and you are welcome to redistribute it under certain cond #else #define assert(expr) do {} while (0) #define dprintk(fmt, args...) do {} while (0) -#endif /* RTL8125_DEBUG */ +#endif /* RTL8126_DEBUG */ -#define R8125_MSG_DEFAULT \ +#define R8126_MSG_DEFAULT \ (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN) -#ifdef CONFIG_R8125_NAPI -#define rtl8125_rx_hwaccel_skb vlan_hwaccel_receive_skb -#define rtl8125_rx_quota(count, quota) min(count, quota) +#ifdef CONFIG_R8126_NAPI +#define rtl8126_rx_hwaccel_skb vlan_hwaccel_receive_skb +#define rtl8126_rx_quota(count, quota) min(count, quota) #else -#define rtl8125_rx_hwaccel_skb vlan_hwaccel_rx -#define rtl8125_rx_quota(count, quota) count +#define rtl8126_rx_hwaccel_skb vlan_hwaccel_rx +#define rtl8126_rx_quota(count, quota) count #endif /* MAC address length */ @@ -516,6 +528,7 @@ This is free software, and you are welcome to redistribute it under certain cond #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 TX_DMA_BURST_unlimited 7 #define TX_DMA_BURST_1024 6 #define TX_DMA_BURST_512 5 @@ -542,26 +555,29 @@ This is free software, and you are welcome to redistribute it under certain cond #define Rx_Close_Multiple (1 << 21) #define Rx_Fetch_Number_8 (1 << 30) -#define R8125_REGS_SIZE (256) -#define R8125_MAC_REGS_SIZE (256) -#define R8125_PHY_REGS_SIZE (16*2) -#define R8125_EPHY_REGS_SIZE (31*2) -#define R8125_ERI_REGS_SIZE (0x100) -#define R8125_REGS_DUMP_SIZE (0x400) -#define R8125_PCI_REGS_SIZE (0x100) -#define R8125_NAPI_WEIGHT 64 +#define R8126_REGS_SIZE (256) +#define R8126_MAC_REGS_SIZE (256) +#define R8126_PHY_REGS_SIZE (16*2) +#define R8126_EPHY_REGS_SIZE (31*2) +#define R8126_ERI_REGS_SIZE (0x100) +#define R8126_REGS_DUMP_SIZE (0x400) +#define R8126_PCI_REGS_SIZE (0x100) +#define R8126_NAPI_WEIGHT 64 -#define R8125_MAX_MSIX_VEC_8125A 4 -#define R8125_MAX_MSIX_VEC_8125B 32 -#define R8125_MIN_MSIX_VEC_8125B 22 -#define R8125_MAX_MSIX_VEC 32 -#define R8125_MAX_RX_QUEUES_VEC_V3 (16) +#define R8126_MAX_MSIX_VEC_8125A 4 +#define R8126_MAX_MSIX_VEC_8125B 32 +#define R8126_MAX_MSIX_VEC_8125D 32 +#define R8126_MIN_MSIX_VEC_8125B 22 +#define R8126_MIN_MSIX_VEC_8125BP 31 +#define R8126_MIN_MSIX_VEC_8125D 20 +#define R8126_MAX_MSIX_VEC 32 +#define R8126_MAX_RX_QUEUES_VEC_V3 (16) -#define RTL8125_TX_TIMEOUT (6 * HZ) -#define RTL8125_LINK_TIMEOUT (1 * HZ) -#define RTL8125_ESD_TIMEOUT (2 * HZ) +#define RTL8126_TX_TIMEOUT (6 * HZ) +#define RTL8126_LINK_TIMEOUT (1 * HZ) +#define RTL8126_ESD_TIMEOUT (2 * HZ) -#define rtl8125_rx_page_size(order) (PAGE_SIZE << order) +#define rtl8126_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 */ @@ -580,21 +596,21 @@ This is free software, and you are welcome to redistribute it under certain cond #define RT_VALN_HLEN 4 /* 4(single vlan) bytes */ #endif -#define R8125_MAX_TX_QUEUES (2) -#define R8125_MAX_RX_QUEUES (4) -#define R8125_MAX_QUEUES R8125_MAX_RX_QUEUES +#define R8126_MAX_TX_QUEUES (2) +#define R8126_MAX_RX_QUEUES (4) +#define R8126_MAX_QUEUES R8126_MAX_RX_QUEUES #define OCP_STD_PHY_BASE 0xa400 //Channel Wait Count -#define R8125_CHANNEL_WAIT_COUNT (20000) -#define R8125_CHANNEL_WAIT_TIME (1) // 1us -#define R8125_CHANNEL_EXIT_DELAY_TIME (20) //20us +#define R8126_CHANNEL_WAIT_COUNT (20000) +#define R8126_CHANNEL_WAIT_TIME (1) // 1us +#define R8126_CHANNEL_EXIT_DELAY_TIME (20) //20us #ifdef ENABLE_LIB_SUPPORT -#define R8125_MULTI_RX_Q(tp) 0 +#define R8126_MULTI_RX_Q(tp) 0 #else -#define R8125_MULTI_RX_Q(tp) (tp->num_rx_rings > 1) +#define R8126_MULTI_RX_Q(tp) (tp->num_rx_rings > 1) #endif #define NODE_ADDRESS_SIZE 6 @@ -694,7 +710,7 @@ This is free software, and you are welcome to redistribute it under certain cond #define D0_SPEED_UP_SPEED_2500 2 #define D0_SPEED_UP_SPEED_5000 3 -#define RTL8125_MAC_MCU_PAGE_SIZE 256 //256 words +#define RTL8126_MAC_MCU_PAGE_SIZE 256 //256 words #ifndef WRITE_ONCE #define WRITE_ONCE(var, val) (*((volatile typeof(val) *)(&(var))) = (val)) @@ -798,7 +814,7 @@ typedef int napi_budget; #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) /*****************************************************************************/ -#ifdef CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) #define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) napi_consume_skb(skb, budget) #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) @@ -806,13 +822,13 @@ typedef int napi_budget; #else #define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_kfree_skb_any(skb); #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) -#else //CONFIG_R8125_NAPI +#else //CONFIG_R8126_NAPI #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0) #define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_consume_skb_any(skb); #else #define RTL_NAPI_CONSUME_SKB_ANY(skb, budget) dev_kfree_skb_any(skb); #endif -#endif //CONFIG_R8125_NAPI +#endif //CONFIG_R8126_NAPI /*****************************************************************************/ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9) @@ -1258,7 +1274,7 @@ struct _kc_ethtool_pauseparam { /*****************************************************************************/ -enum RTL8125_registers { +enum RTL8126_registers { MAC0 = 0x00, /* Ethernet hardware address. */ MAC4 = 0x04, MAR0 = 0x08, /* Multicast filter. */ @@ -1357,6 +1373,13 @@ 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, @@ -1401,7 +1424,7 @@ enum RTL8125_registers { TCAM_VLAN_TAG_V2 = 0x03, }; -enum RTL8125_register_content { +enum RTL8126_register_content { /* InterruptStatusBits */ SYSErr = 0x8000, PCSTimeout = 0x4000, @@ -1469,6 +1492,7 @@ 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, @@ -1525,7 +1549,7 @@ enum RTL8125_register_content { INTT_2 = 0x0002, INTT_3 = 0x0003, - /* rtl8125_PHYstatus */ + /* rtl8126_PHYstatus */ PowerSaveStatus = 0x80, _5000bpsF = 0x1000, _2500bpsF = 0x400, @@ -1637,13 +1661,22 @@ enum RTL8125_register_content { 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, + RTL8126_MAGIC_NUMBER = 0x0badbadbadbadbadull, }; enum _DescStatusBit { @@ -1776,15 +1809,15 @@ enum bits { BIT_31 = (1 << 31) }; -#define RTL8125_CP_NUM 4 -#define RTL8125_MAX_SUPPORT_CP_LEN 110 +#define RTL8126_CP_NUM 4 +#define RTL8126_MAX_SUPPORT_CP_LEN 110 -enum rtl8125_cp_status { - rtl8125_cp_normal = 0, - rtl8125_cp_short, - rtl8125_cp_open, - rtl8125_cp_mismatch, - rtl8125_cp_unknown +enum rtl8126_cp_status { + rtl8126_cp_normal = 0, + rtl8126_cp_short, + rtl8126_cp_open, + rtl8126_cp_mismatch, + rtl8126_cp_unknown }; enum efuse { @@ -1875,6 +1908,7 @@ 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 }; @@ -1911,20 +1945,20 @@ struct pci_resource { u32 pci_sn_h; }; -enum r8125_flag { - R8125_FLAG_DOWN = 0, - R8125_FLAG_TASK_RESET_PENDING, - R8125_FLAG_TASK_ESD_CHECK_PENDING, - R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, - R8125_FLAG_MAX +enum r8126_flag { + R8126_FLAG_DOWN = 0, + R8126_FLAG_TASK_RESET_PENDING, + R8126_FLAG_TASK_ESD_CHECK_PENDING, + R8126_FLAG_TASK_LINKCHG_CHECK_PENDING, + R8126_FLAG_MAX }; -enum r8125_sysfs_flag { - R8125_SYSFS_RTL_ADV = 0, - R8125_SYSFS_FLAG_MAX +enum r8126_sysfs_flag { + R8126_SYSFS_RTL_ADV = 0, + R8126_SYSFS_FLAG_MAX }; -struct rtl8125_tx_ring { +struct rtl8126_tx_ring { void* priv; struct net_device *netdev; u32 index; @@ -1945,7 +1979,7 @@ struct rtl8125_tx_ring { u16 tdsar_reg; /* Transmit Descriptor Start Address */ }; -struct rtl8125_rx_buffer { +struct rtl8126_rx_buffer { struct page *page; u32 page_offset; dma_addr_t dma; @@ -1953,7 +1987,7 @@ struct rtl8125_rx_buffer { struct sk_buff *skb; }; -struct rtl8125_rx_ring { +struct rtl8126_rx_ring { void* priv; struct net_device *netdev; u32 index; @@ -1965,7 +1999,7 @@ struct rtl8125_rx_ring { 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]; + struct rtl8126_rx_buffer rx_buffer[MAX_NUM_RX_DESC]; u16 rx_offset; #else struct sk_buff *Rx_skbuff[MAX_NUM_RX_DESC]; /* Rx data buffers */ @@ -1974,8 +2008,8 @@ struct rtl8125_rx_ring { u16 rdsar_reg; /* Receive Descriptor Start Address */ }; -struct r8125_napi { -#ifdef CONFIG_R8125_NAPI +struct r8126_napi { +#ifdef CONFIG_R8126_NAPI #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) struct napi_struct napi; #endif @@ -1984,7 +2018,7 @@ struct r8125_napi { int index; }; -struct r8125_irq { +struct r8126_irq { irq_handler_t handler; unsigned int vector; u8 requested; @@ -1992,7 +2026,7 @@ struct r8125_irq { }; #pragma pack(1) -struct rtl8125_regs { +struct rtl8126_regs { //00 u8 mac_id[6]; u16 reg_06; @@ -2100,18 +2134,18 @@ struct rtl8125_regs { }; #pragma pack() -struct rtl8125_regs_save { +struct rtl8126_regs_save { union { - u8 mac_io[R8125_MAC_REGS_SIZE]; + u8 mac_io[R8126_MAC_REGS_SIZE]; - struct rtl8125_regs mac_reg; + struct rtl8126_regs mac_reg; }; - u16 pcie_phy[R8125_EPHY_REGS_SIZE/2]; - u16 eth_phy[R8125_PHY_REGS_SIZE/2]; - u32 eri_reg[R8125_ERI_REGS_SIZE/4]; - u32 pci_reg[R8125_PCI_REGS_SIZE/4]; - u16 sw_tail_ptr_reg[R8125_MAX_TX_QUEUES]; - u16 hw_clo_ptr_reg[R8125_MAX_TX_QUEUES]; + u16 pcie_phy[R8126_EPHY_REGS_SIZE/2]; + u16 eth_phy[R8126_PHY_REGS_SIZE/2]; + u32 eri_reg[R8126_ERI_REGS_SIZE/4]; + u32 pci_reg[R8126_PCI_REGS_SIZE/4]; + u16 sw_tail_ptr_reg[R8126_MAX_TX_QUEUES]; + u16 hw_clo_ptr_reg[R8126_MAX_TX_QUEUES]; //ktime_t begin_ktime; //ktime_t end_ktime; @@ -2145,12 +2179,12 @@ struct rtl8125_regs_save { u32 rxq1_dsc_st_addr_2; u32 rss_ctrl; - u8 rss_key[RTL8125_RSS_KEY_SIZE]; - u8 rss_i_table[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES]; + u8 rss_key[RTL8126_RSS_KEY_SIZE]; + u8 rss_i_table[RTL8126_MAX_INDIRECTION_TABLE_ENTRIES]; u16 rss_queue_num_sel_r; }; -struct rtl8125_counters { +struct rtl8126_counters { /* legacy */ u64 tx_packets; u64 rx_packets; @@ -2196,32 +2230,32 @@ struct rtl8125_counters { }; /* Flow Control Settings */ -enum rtl8125_fc_mode { - rtl8125_fc_none = 0, - rtl8125_fc_rx_pause, - rtl8125_fc_tx_pause, - rtl8125_fc_full, - rtl8125_fc_default +enum rtl8126_fc_mode { + rtl8126_fc_none = 0, + rtl8126_fc_rx_pause, + rtl8126_fc_tx_pause, + rtl8126_fc_full, + rtl8126_fc_default }; -enum rtl8125_state_t { - __RTL8125_TESTING = 0, - __RTL8125_RESETTING, - __RTL8125_DOWN, - __RTL8125_PTP_TX_IN_PROGRESS, +enum rtl8126_state_t { + __RTL8126_TESTING = 0, + __RTL8126_RESETTING, + __RTL8126_DOWN, + __RTL8126_PTP_TX_IN_PROGRESS, }; -struct rtl8125_private { +struct rtl8126_private { void __iomem *mmio_addr; /* memory map physical address */ struct pci_dev *pci_dev; /* Index of PCI device */ struct net_device *dev; - struct r8125_napi r8125napi[R8125_MAX_MSIX_VEC]; - struct r8125_irq irq_tbl[R8125_MAX_MSIX_VEC]; + struct r8126_napi r8126napi[R8126_MAX_MSIX_VEC]; + struct r8126_irq irq_tbl[R8126_MAX_MSIX_VEC]; 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 msix_entry msix_entries[R8126_MAX_MSIX_VEC]; struct net_device_stats stats; /* statistics of net device */ unsigned long state; @@ -2253,33 +2287,33 @@ struct rtl8125_private { u16 HwSuppNumRxQueues; unsigned int num_tx_rings; unsigned int num_rx_rings; - struct rtl8125_tx_ring tx_ring[R8125_MAX_TX_QUEUES]; - struct rtl8125_rx_ring rx_ring[R8125_MAX_RX_QUEUES]; + struct rtl8126_tx_ring tx_ring[R8126_MAX_TX_QUEUES]; + struct rtl8126_rx_ring rx_ring[R8126_MAX_RX_QUEUES]; #ifdef ENABLE_LIB_SUPPORT struct blocking_notifier_head lib_nh; - struct rtl8125_ring lib_tx_ring[R8125_MAX_TX_QUEUES]; - struct rtl8125_ring lib_rx_ring[R8125_MAX_RX_QUEUES]; + struct rtl8126_ring lib_tx_ring[R8126_MAX_TX_QUEUES]; + struct rtl8126_ring lib_rx_ring[R8126_MAX_RX_QUEUES]; #endif //struct timer_list esd_timer; //struct timer_list link_timer; struct pci_resource pci_cfg_space; unsigned int esd_flag; unsigned int pci_cfg_is_read; - unsigned int rtl8125_rx_config; + unsigned int rtl8126_rx_config; u16 rms; u16 cp_cmd; u32 intr_mask; u32 timer_intr_mask; - u16 isr_reg[R8125_MAX_QUEUES]; - u16 imr_reg[R8125_MAX_QUEUES]; + u16 isr_reg[R8126_MAX_QUEUES]; + u16 imr_reg[R8126_MAX_QUEUES]; int phy_auto_nego_reg; int phy_1000_ctrl_reg; int phy_2500_ctrl_reg; u8 org_mac_addr[NODE_ADDRESS_SIZE]; - struct rtl8125_counters *tally_vaddr; + struct rtl8126_counters *tally_vaddr; dma_addr_t tally_paddr; -#ifdef CONFIG_R8125_VLAN +#ifdef CONFIG_R8126_VLAN struct vlan_group *vlgrp; #endif u8 wol_enabled; @@ -2290,7 +2324,7 @@ struct rtl8125_private { u8 duplex; u32 speed; u64 advertising; - enum rtl8125_fc_mode fcpause; + enum rtl8126_fc_mode fcpause; u32 HwSuppMaxPhyLinkSpeed; u16 eeprom_len; u16 cur_page; @@ -2314,7 +2348,7 @@ struct rtl8125_private { struct delayed_work esd_task; struct delayed_work linkchg_task; #endif - DECLARE_BITMAP(task_flags, R8125_FLAG_MAX); + DECLARE_BITMAP(task_flags, R8126_FLAG_MAX); unsigned features; u8 org_pci_offset_99; @@ -2353,8 +2387,6 @@ struct rtl8125_private { u8 RequirePhyMdiSwapPatch; - u8 RequireLSOPatch; - u32 HwFiberModeVer; u32 HwFiberStat; u8 HwSwitchMdiToFiber; @@ -2396,7 +2428,7 @@ struct rtl8125_private { u8 ring_lib_enabled; const char *fw_name; - struct rtl8125_fw *rtl_fw; + struct rtl8126_fw *rtl_fw; u32 ocp_base; //Dash+++++++++++++++++ @@ -2404,6 +2436,7 @@ struct rtl8125_private { u8 DASH; u8 dash_printer_enabled; u8 HwPkgDet; + u8 AllowAccessDashOcp; void __iomem *mapped_cmac_ioaddr; /* mapped cmac memory map physical address */ void __iomem *cmac_ioaddr; /* cmac memory map physical address */ @@ -2490,15 +2523,15 @@ struct rtl8125_private { struct ethtool_eee eee; -#ifdef ENABLE_R8125_PROCFS +#ifdef ENABLE_R8126_PROCFS //Procfs support struct proc_dir_entry *proc_dir; struct proc_dir_entry *proc_dir_debug; struct proc_dir_entry *proc_dir_test; #endif -#ifdef ENABLE_R8125_SYSFS +#ifdef ENABLE_R8126_SYSFS //sysfs support - DECLARE_BITMAP(sysfs_flag, R8125_SYSFS_FLAG_MAX); + DECLARE_BITMAP(sysfs_flag, R8126_SYSFS_FLAG_MAX); u32 testmode; #endif u8 InitRxDescType; @@ -2524,8 +2557,8 @@ struct rtl8125_private { #ifdef ENABLE_RSS_SUPPORT u32 rss_flags; /* Receive Side Scaling settings */ - u8 rss_key[RTL8125_RSS_KEY_SIZE]; - u8 rss_indir_tbl[RTL8125_MAX_INDIRECTION_TABLE_ENTRIES]; + u8 rss_key[RTL8126_RSS_KEY_SIZE]; + u8 rss_indir_tbl[RTL8126_MAX_INDIRECTION_TABLE_ENTRIES]; u32 rss_options; #endif @@ -2542,7 +2575,7 @@ struct rtl8125_private { #ifdef ENABLE_LIB_SUPPORT static inline unsigned int -rtl8125_num_lib_tx_rings(struct rtl8125_private *tp) +rtl8126_num_lib_tx_rings(struct rtl8126_private *tp) { int count, i; @@ -2554,7 +2587,7 @@ rtl8125_num_lib_tx_rings(struct rtl8125_private *tp) } static inline unsigned int -rtl8125_num_lib_rx_rings(struct rtl8125_private *tp) +rtl8126_num_lib_rx_rings(struct rtl8126_private *tp) { int count, i; @@ -2567,31 +2600,31 @@ rtl8125_num_lib_rx_rings(struct rtl8125_private *tp) #else static inline unsigned int -rtl8125_num_lib_tx_rings(struct rtl8125_private *tp) +rtl8126_num_lib_tx_rings(struct rtl8126_private *tp) { return 0; } static inline unsigned int -rtl8125_num_lib_rx_rings(struct rtl8125_private *tp) +rtl8126_num_lib_rx_rings(struct rtl8126_private *tp) { return 0; } #endif static inline unsigned int -rtl8125_tot_tx_rings(struct rtl8125_private *tp) +rtl8126_tot_tx_rings(struct rtl8126_private *tp) { - return tp->num_tx_rings + rtl8125_num_lib_tx_rings(tp); + return tp->num_tx_rings + rtl8126_num_lib_tx_rings(tp); } static inline unsigned int -rtl8125_tot_rx_rings(struct rtl8125_private *tp) +rtl8126_tot_rx_rings(struct rtl8126_private *tp) { - return tp->num_rx_rings + rtl8125_num_lib_rx_rings(tp); + return tp->num_rx_rings + rtl8126_num_lib_rx_rings(tp); } -static inline struct netdev_queue *txring_txq(const struct rtl8125_tx_ring *ring) +static inline struct netdev_queue *txring_txq(const struct rtl8126_tx_ring *ring) { return netdev_get_tx_queue(ring->netdev, ring->index); } @@ -2604,15 +2637,9 @@ enum eetype { }; enum mcfg { - CFG_METHOD_2=2, + CFG_METHOD_1=1, + CFG_METHOD_2, CFG_METHOD_3, - CFG_METHOD_4, - CFG_METHOD_5, - CFG_METHOD_6, - CFG_METHOD_7, - CFG_METHOD_8, - CFG_METHOD_9, - CFG_METHOD_10, CFG_METHOD_DEFAULT, CFG_METHOD_MAX }; @@ -2643,13 +2670,9 @@ enum mcfg { #define WAKEUP_MAGIC_PACKET_V3 (3) //Ram Code Version -#define NIC_RAMCODE_VERSION_CFG_METHOD_2 (0x0b11) -#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0b33) -#define NIC_RAMCODE_VERSION_CFG_METHOD_4 (0x0b17) -#define NIC_RAMCODE_VERSION_CFG_METHOD_5 (0x0b74) -#define NIC_RAMCODE_VERSION_CFG_METHOD_8 (0x0023) -#define NIC_RAMCODE_VERSION_CFG_METHOD_9 (0x0033) -#define NIC_RAMCODE_VERSION_CFG_METHOD_10 (0x0001) +#define NIC_RAMCODE_VERSION_CFG_METHOD_1 (0x0023) +#define NIC_RAMCODE_VERSION_CFG_METHOD_2 (0x0033) +#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0048) //hwoptimize #define HW_PATCH_SOC_LAN (BIT_0) @@ -2657,93 +2680,93 @@ enum mcfg { static const u16 other_q_intr_mask = (RxOK1 | RxDU1); -void rtl8125_mdio_write(struct rtl8125_private *tp, u16 RegAddr, u16 value); -void rtl8125_mdio_prot_write(struct rtl8125_private *tp, u32 RegAddr, u32 value); -void rtl8125_mdio_prot_direct_write_phy_ocp(struct rtl8125_private *tp, u32 RegAddr, u32 value); -u32 rtl8125_mdio_read(struct rtl8125_private *tp, u16 RegAddr); -u32 rtl8125_mdio_prot_read(struct rtl8125_private *tp, u32 RegAddr); -u32 rtl8125_mdio_prot_direct_read_phy_ocp(struct rtl8125_private *tp, u32 RegAddr); -void rtl8125_ephy_write(struct rtl8125_private *tp, int RegAddr, int value); -void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value); -u16 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); -void rtl8125_oob_mutex_lock(struct rtl8125_private *tp); -u32 rtl8125_ocp_read(struct rtl8125_private *tp, u16 addr, u8 len); -u32 rtl8125_ocp_read_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 base_address); -u32 rtl8125_ocp_write_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 value, u32 base_address); -u32 rtl8125_eri_read(struct rtl8125_private *tp, int addr, int len, int type); -u32 rtl8125_eri_read_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, int type, u32 base_address); -int rtl8125_eri_write(struct rtl8125_private *tp, int addr, int len, u32 value, int type); -int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, u32 value, int type, u32 base_address); -u16 rtl8125_ephy_read(struct rtl8125_private *tp, int RegAddr); -void rtl8125_wait_txrx_fifo_empty(struct net_device *dev); -void rtl8125_enable_now_is_oob(struct rtl8125_private *tp); -void rtl8125_disable_now_is_oob(struct rtl8125_private *tp); -void rtl8125_oob_mutex_unlock(struct rtl8125_private *tp); -void rtl8125_dash2_disable_tx(struct rtl8125_private *tp); -void rtl8125_dash2_enable_tx(struct rtl8125_private *tp); -void rtl8125_dash2_disable_rx(struct rtl8125_private *tp); -void rtl8125_dash2_enable_rx(struct rtl8125_private *tp); -void rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev); -void rtl8125_mark_to_asic(struct rtl8125_private *tp, struct RxDesc *desc, u32 rx_buf_sz); +void rtl8126_mdio_write(struct rtl8126_private *tp, u16 RegAddr, u16 value); +void rtl8126_mdio_prot_write(struct rtl8126_private *tp, u32 RegAddr, u32 value); +void rtl8126_mdio_prot_direct_write_phy_ocp(struct rtl8126_private *tp, u32 RegAddr, u32 value); +u32 rtl8126_mdio_read(struct rtl8126_private *tp, u16 RegAddr); +u32 rtl8126_mdio_prot_read(struct rtl8126_private *tp, u32 RegAddr); +u32 rtl8126_mdio_prot_direct_read_phy_ocp(struct rtl8126_private *tp, u32 RegAddr); +void rtl8126_ephy_write(struct rtl8126_private *tp, int RegAddr, int value); +void rtl8126_mac_ocp_write(struct rtl8126_private *tp, u16 reg_addr, u16 value); +u16 rtl8126_mac_ocp_read(struct rtl8126_private *tp, u16 reg_addr); +void rtl8126_clear_eth_phy_bit(struct rtl8126_private *tp, u8 addr, u16 mask); +void rtl8126_set_eth_phy_bit(struct rtl8126_private *tp, u8 addr, u16 mask); +void rtl8126_ocp_write(struct rtl8126_private *tp, u16 addr, u8 len, u32 data); +void rtl8126_oob_notify(struct rtl8126_private *tp, u8 cmd); +void rtl8126_init_ring_indexes(struct rtl8126_private *tp); +void rtl8126_oob_mutex_lock(struct rtl8126_private *tp); +u32 rtl8126_ocp_read(struct rtl8126_private *tp, u16 addr, u8 len); +u32 rtl8126_ocp_read_with_oob_base_address(struct rtl8126_private *tp, u16 addr, u8 len, u32 base_address); +u32 rtl8126_ocp_write_with_oob_base_address(struct rtl8126_private *tp, u16 addr, u8 len, u32 value, u32 base_address); +u32 rtl8126_eri_read(struct rtl8126_private *tp, int addr, int len, int type); +u32 rtl8126_eri_read_with_oob_base_address(struct rtl8126_private *tp, int addr, int len, int type, u32 base_address); +int rtl8126_eri_write(struct rtl8126_private *tp, int addr, int len, u32 value, int type); +int rtl8126_eri_write_with_oob_base_address(struct rtl8126_private *tp, int addr, int len, u32 value, int type, u32 base_address); +u16 rtl8126_ephy_read(struct rtl8126_private *tp, int RegAddr); +void rtl8126_wait_txrx_fifo_empty(struct net_device *dev); +void rtl8126_enable_now_is_oob(struct rtl8126_private *tp); +void rtl8126_disable_now_is_oob(struct rtl8126_private *tp); +void rtl8126_oob_mutex_unlock(struct rtl8126_private *tp); +void rtl8126_dash2_disable_tx(struct rtl8126_private *tp); +void rtl8126_dash2_enable_tx(struct rtl8126_private *tp); +void rtl8126_dash2_disable_rx(struct rtl8126_private *tp); +void rtl8126_dash2_enable_rx(struct rtl8126_private *tp); +void rtl8126_hw_disable_mac_mcu_bps(struct net_device *dev); +void rtl8126_mark_to_asic(struct rtl8126_private *tp, struct RxDesc *desc, u32 rx_buf_sz); static inline void -rtl8125_make_unusable_by_asic(struct rtl8125_private *tp, +rtl8126_make_unusable_by_asic(struct rtl8126_private *tp, struct RxDesc *desc) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { - ((struct RxDescV3 *)desc)->addr = RTL8125_MAGIC_NUMBER; + ((struct RxDescV3 *)desc)->addr = RTL8126_MAGIC_NUMBER; ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV3); } else { - desc->addr = RTL8125_MAGIC_NUMBER; + desc->addr = RTL8126_MAGIC_NUMBER; desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); } } static inline struct RxDesc* -rtl8125_get_rxdesc(struct rtl8125_private *tp, struct RxDesc *RxDescBase, u32 const cur_rx) +rtl8126_get_rxdesc(struct rtl8126_private *tp, struct RxDesc *RxDescBase, u32 const cur_rx) { return (struct RxDesc*)((u8*)RxDescBase + (cur_rx * tp->RxDescLength)); } static inline void -rtl8125_disable_hw_interrupt_v2(struct rtl8125_private *tp, +rtl8126_disable_hw_interrupt_v2(struct rtl8126_private *tp, u32 message_id) { RTL_W32(tp, IMR_V2_CLEAR_REG_8125, BIT(message_id)); } static inline void -rtl8125_enable_hw_interrupt_v2(struct rtl8125_private *tp, u32 message_id) +rtl8126_enable_hw_interrupt_v2(struct rtl8126_private *tp, u32 message_id) { RTL_W32(tp, IMR_V2_SET_REG_8125, BIT(message_id)); } -int rtl8125_open(struct net_device *dev); -int rtl8125_close(struct net_device *dev); -void rtl8125_hw_config(struct net_device *dev); -void rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, u32 message_id, u8 timer_intmiti_val); -void rtl8125_set_rx_q_num(struct rtl8125_private *tp, unsigned int num_rx_queues); -void rtl8125_set_tx_q_num(struct rtl8125_private *tp, unsigned int num_tx_queues); -void rtl8125_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); -void rtl8125_rx_clear(struct rtl8125_private *tp); -int rtl8125_init_ring(struct net_device *dev); -void rtl8125_hw_set_rx_packet_filter(struct net_device *dev); -void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp); -int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr); -void rtl8125_enable_napi(struct rtl8125_private *tp); -void _rtl8125_wait_for_quiescence(struct net_device *dev); +int rtl8126_open(struct net_device *dev); +int rtl8126_close(struct net_device *dev); +void rtl8126_hw_config(struct net_device *dev); +void rtl8126_hw_set_timer_int_8125(struct rtl8126_private *tp, u32 message_id, u8 timer_intmiti_val); +void rtl8126_set_rx_q_num(struct rtl8126_private *tp, unsigned int num_rx_queues); +void rtl8126_set_tx_q_num(struct rtl8126_private *tp, unsigned int num_tx_queues); +void rtl8126_enable_mcu(struct rtl8126_private *tp, bool enable); +void rtl8126_hw_start(struct net_device *dev); +void rtl8126_hw_reset(struct net_device *dev); +void rtl8126_tx_clear(struct rtl8126_private *tp); +void rtl8126_rx_clear(struct rtl8126_private *tp); +int rtl8126_init_ring(struct net_device *dev); +void rtl8126_hw_set_rx_packet_filter(struct net_device *dev); +void rtl8126_enable_hw_linkchg_interrupt(struct rtl8126_private *tp); +int rtl8126_dump_tally_counter(struct rtl8126_private *tp, dma_addr_t paddr); +void rtl8126_enable_napi(struct rtl8126_private *tp); +void _rtl8126_wait_for_quiescence(struct net_device *dev); #ifndef ENABLE_LIB_SUPPORT -static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { } -static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { } +static inline void rtl8126_lib_reset_prepare(struct rtl8126_private *tp) { } +static inline void rtl8126_lib_reset_complete(struct rtl8126_private *tp) { } #endif #define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M) ((_M)->HwSuppCheckPhyDisableModeVer > 0 ) @@ -2763,4 +2786,4 @@ static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { } for (mclist = dev->mc_list; mclist; mclist = mclist->next) #endif -#endif /* __R8125_H */ +#endif /* __R8126_H */ diff --git a/r8125_dash.h b/r8126_dash.h similarity index 96% rename from r8125_dash.h rename to r8126_dash.h index b502d11..b0a2f11 100644 --- a/r8125_dash.h +++ b/r8126_dash.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,8 +32,8 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ -#ifndef _LINUX_R8125_DASH_H -#define _LINUX_R8125_DASH_H +#ifndef _LINUX_R8126_DASH_H +#define _LINUX_R8126_DASH_H #include @@ -251,11 +251,11 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2; #define RTL_CMAC_R16(tp, reg) readw (tp->cmac_ioaddr + (reg)) #define RTL_CMAC_R32(tp, reg) ((unsigned long) readl (tp->cmac_ioaddr + (reg))) -int rtl8125_dash_ioctl(struct net_device *dev, struct ifreq *ifr); +int rtl8126_dash_ioctl(struct net_device *dev, struct ifreq *ifr); void HandleDashInterrupt(struct net_device *dev); int AllocateDashShareMemory(struct net_device *dev); void FreeAllocatedDashShareMemory(struct net_device *dev); void DashHwInit(struct net_device *dev); -#endif /* _LINUX_R8125_DASH_H */ +#endif /* _LINUX_R8126_DASH_H */ diff --git a/r8125_firmware.c b/r8126_firmware.c similarity index 88% rename from r8125_firmware.c rename to r8126_firmware.c index 3d4dd79..a7b13cb 100644 --- a/r8125_firmware.c +++ b/r8126_firmware.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -36,7 +36,7 @@ #include #include -#include "r8125_firmware.h" +#include "r8126_firmware.h" enum rtl_fw_opcode { PHY_READ = 0x0, @@ -56,7 +56,7 @@ enum rtl_fw_opcode { struct fw_info { u32 magic; - char version[RTL8125_VER_SIZE]; + char version[RTL8126_VER_SIZE]; __le32 fw_start; __le32 fw_len; u8 chksum; @@ -65,13 +65,13 @@ struct fw_info { #if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0) #define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) #endif -#define FW_OPCODE_SIZE sizeof_field(struct rtl8125_fw_phy_action, code[0]) +#define FW_OPCODE_SIZE sizeof_field(struct rtl8126_fw_phy_action, code[0]) -static bool rtl8125_fw_format_ok(struct rtl8125_fw *rtl_fw) +static bool rtl8126_fw_format_ok(struct rtl8126_fw *rtl_fw) { const struct firmware *fw = rtl_fw->fw; struct fw_info *fw_info = (struct fw_info *)fw->data; - struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action; + struct rtl8126_fw_phy_action *pa = &rtl_fw->phy_action; if (fw->size < FW_OPCODE_SIZE) return false; @@ -96,7 +96,7 @@ static bool rtl8125_fw_format_ok(struct rtl8125_fw *rtl_fw) if (size > (fw->size - start) / FW_OPCODE_SIZE) return false; - strscpy(rtl_fw->version, fw_info->version, RTL8125_VER_SIZE); + strscpy(rtl_fw->version, fw_info->version, RTL8126_VER_SIZE); pa->code = (__le32 *)(fw->data + start); pa->size = size; @@ -104,7 +104,7 @@ static bool rtl8125_fw_format_ok(struct rtl8125_fw *rtl_fw) if (fw->size % FW_OPCODE_SIZE) return false; - strscpy(rtl_fw->version, rtl_fw->fw_name, RTL8125_VER_SIZE); + strscpy(rtl_fw->version, rtl_fw->fw_name, RTL8126_VER_SIZE); pa->code = (__le32 *)fw->data; pa->size = fw->size / FW_OPCODE_SIZE; @@ -113,9 +113,9 @@ static bool rtl8125_fw_format_ok(struct rtl8125_fw *rtl_fw) return true; } -static bool rtl8125_fw_data_ok(struct rtl8125_fw *rtl_fw) +static bool rtl8126_fw_data_ok(struct rtl8126_fw *rtl_fw) { - struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action; + struct rtl8126_fw_phy_action *pa = &rtl_fw->phy_action; size_t index; for (index = 0; index < pa->size; index++) { @@ -165,11 +165,11 @@ out: return false; } -void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rtl_fw) +void rtl8126_fw_write_firmware(struct rtl8126_private *tp, struct rtl8126_fw *rtl_fw) { - struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action; - rtl8125_fw_write_t fw_write = rtl_fw->phy_write; - rtl8125_fw_read_t fw_read = rtl_fw->phy_read; + struct rtl8126_fw_phy_action *pa = &rtl_fw->phy_action; + rtl8126_fw_write_t fw_write = rtl_fw->phy_write; + rtl8126_fw_read_t fw_read = rtl_fw->phy_read; int predata = 0, count = 0; size_t index; @@ -237,12 +237,12 @@ void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rt } } -void rtl8125_fw_release_firmware(struct rtl8125_fw *rtl_fw) +void rtl8126_fw_release_firmware(struct rtl8126_fw *rtl_fw) { release_firmware(rtl_fw->fw); } -int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw) +int rtl8126_fw_request_firmware(struct rtl8126_fw *rtl_fw) { int rc; @@ -250,7 +250,7 @@ int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw) if (rc < 0) goto out; - if (!rtl8125_fw_format_ok(rtl_fw) || !rtl8125_fw_data_ok(rtl_fw)) { + if (!rtl8126_fw_format_ok(rtl_fw) || !rtl8126_fw_data_ok(rtl_fw)) { release_firmware(rtl_fw->fw); rc = -EINVAL; goto out; diff --git a/r8125_firmware.h b/r8126_firmware.h similarity index 63% rename from r8125_firmware.h rename to r8126_firmware.h index 13030ab..5ae6f93 100644 --- a/r8125_firmware.h +++ b/r8126_firmware.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,37 +32,37 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ -#ifndef _LINUX_rtl8125_FIRMWARE_H -#define _LINUX_rtl8125_FIRMWARE_H +#ifndef _LINUX_R8126_FIRMWARE_H +#define _LINUX_R8126_FIRMWARE_H #include #include -struct rtl8125_private; -typedef void (*rtl8125_fw_write_t)(struct rtl8125_private *tp, u16 reg, u16 val); -typedef u32 (*rtl8125_fw_read_t)(struct rtl8125_private *tp, u16 reg); +struct rtl8126_private; +typedef void (*rtl8126_fw_write_t)(struct rtl8126_private *tp, u16 reg, u16 val); +typedef u32 (*rtl8126_fw_read_t)(struct rtl8126_private *tp, u16 reg); -#define RTL8125_VER_SIZE 32 +#define RTL8126_VER_SIZE 32 -struct rtl8125_fw { - rtl8125_fw_write_t phy_write; - rtl8125_fw_read_t phy_read; - rtl8125_fw_write_t mac_mcu_write; - rtl8125_fw_read_t mac_mcu_read; +struct rtl8126_fw { + rtl8126_fw_write_t phy_write; + rtl8126_fw_read_t phy_read; + rtl8126_fw_write_t mac_mcu_write; + rtl8126_fw_read_t mac_mcu_read; const struct firmware *fw; const char *fw_name; struct device *dev; - char version[RTL8125_VER_SIZE]; + char version[RTL8126_VER_SIZE]; - struct rtl8125_fw_phy_action { + struct rtl8126_fw_phy_action { __le32 *code; size_t size; } phy_action; }; -int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw); -void rtl8125_fw_release_firmware(struct rtl8125_fw *rtl_fw); -void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rtl_fw); +int rtl8126_fw_request_firmware(struct rtl8126_fw *rtl_fw); +void rtl8126_fw_release_firmware(struct rtl8126_fw *rtl_fw); +void rtl8126_fw_write_firmware(struct rtl8126_private *tp, struct rtl8126_fw *rtl_fw); -#endif /* _LINUX_rtl8125_FIRMWARE_H */ +#endif /* _LINUX_R8126_FIRMWARE_H */ diff --git a/r8125_n.c b/r8126_n.c similarity index 58% rename from r8125_n.c rename to r8126_n.c index a8a5fb3..d01c7ef 100644 --- a/r8125_n.c +++ b/r8126_n.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -84,39 +84,27 @@ #include #include -#include "r8125.h" +#include "r8126.h" #include "rtl_eeprom.h" #include "rtltool.h" -#include "r8125_firmware.h" +#include "r8126_firmware.h" -#ifdef ENABLE_R8125_PROCFS +#ifdef ENABLE_R8126_PROCFS #include #include #endif -#define FIRMWARE_8125A_3 "rtl_nic/rtl8125a-3.fw" -#define FIRMWARE_8125B_2 "rtl_nic/rtl8125b-2.fw" -#define FIRMWARE_8126A_1 "rtl_nic/rtl8126a-1.fw" #define FIRMWARE_8126A_2 "rtl_nic/rtl8126a-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; +#define FIRMWARE_8126A_3 "rtl_nic/rtl8126a-3.fw" static const struct { const char *name; const char *fw_name; } rtl_chip_fw_infos[] = { /* PCI-E devices. */ - [CFG_METHOD_2] = {"RTL8125A" }, - [CFG_METHOD_3] = {"RTL8125A", FIRMWARE_8125A_3}, - [CFG_METHOD_4] = {"RTL8125B", }, - [CFG_METHOD_5] = {"RTL8125B", FIRMWARE_8125B_2}, - [CFG_METHOD_6] = {"RTL8168KB", FIRMWARE_8125A_3}, - [CFG_METHOD_7] = {"RTL8168KB", FIRMWARE_8125B_2}, - [CFG_METHOD_8] = {"RTL8126A", FIRMWARE_8126A_1}, - [CFG_METHOD_9] = {"RTL8126A", FIRMWARE_8126A_2}, - [CFG_METHOD_10] = {"RTL8126A", }, + [CFG_METHOD_1] = {"RTL8126A", }, + [CFG_METHOD_2] = {"RTL8126A", FIRMWARE_8126A_2}, + [CFG_METHOD_3] = {"RTL8126A", FIRMWARE_8126A_3}, [CFG_METHOD_DEFAULT] = {"Unknown", }, }; @@ -130,56 +118,20 @@ static const struct { u32 RxConfigMask; /* Clears the bits supported by this chip */ u32 jumbo_frame_sz; } rtl_chip_info[] = { - _R("RTL8125A", + _R("RTL8126A", + CFG_METHOD_1, + Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), + 0xff7e5880, + Jumbo_Frame_9k), + + _R("RTL8126A", CFG_METHOD_2, - Rx_Fetch_Number_8 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125A", - CFG_METHOD_3, - Rx_Fetch_Number_8 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125B", - CFG_METHOD_4, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8125B", - CFG_METHOD_5, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8168KB", - CFG_METHOD_6, - Rx_Fetch_Number_8 | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8168KB", - CFG_METHOD_7, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8126A", - CFG_METHOD_8, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), - 0xff7e5880, - Jumbo_Frame_9k), - - _R("RTL8126A", - CFG_METHOD_9, Rx_Fetch_Number_8 | Rx_Close_Multiple | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_512 << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), _R("RTL8126A", - CFG_METHOD_10, + CFG_METHOD_3, Rx_Fetch_Number_8 | Rx_Close_Multiple | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_512 << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), @@ -197,16 +149,13 @@ static const struct { #define PCI_VENDOR_ID_DLINK 0x1186 #endif -static struct pci_device_id rtl8125_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8125), }, - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8162), }, - { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x3000), }, +static struct pci_device_id rtl8126_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8126), }, { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5000), }, {0,}, }; -MODULE_DEVICE_TABLE(pci, rtl8125_pci_tbl); +MODULE_DEVICE_TABLE(pci, rtl8126_pci_tbl); static int use_dac = 1; static int timer_count = 0x2600; @@ -219,13 +168,6 @@ static struct { static unsigned int speed_mode = SPEED_5000; 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 @@ -278,8 +220,8 @@ static int enable_double_vlan = 1; static int enable_double_vlan = 0; #endif -MODULE_AUTHOR("Realtek and the Linux r8125 crew "); -MODULE_DESCRIPTION("Realtek r8125 Ethernet controller driver"); +MODULE_AUTHOR("Realtek and the Linux r8126 crew "); +MODULE_DESCRIPTION("Realtek r8126 Ethernet controller driver"); module_param(speed_mode, uint, 0); MODULE_PARM_DESC(speed_mode, "force phy operation. Deprecated by ethtool (8)."); @@ -290,9 +232,6 @@ 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."); @@ -336,91 +275,89 @@ MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); MODULE_LICENSE("GPL"); #ifdef ENABLE_USE_FIRMWARE_FILE -MODULE_FIRMWARE(FIRMWARE_8125A_3); -MODULE_FIRMWARE(FIRMWARE_8125B_2); -MODULE_FIRMWARE(FIRMWARE_8126A_1); MODULE_FIRMWARE(FIRMWARE_8126A_2); +MODULE_FIRMWARE(FIRMWARE_8126A_3); #endif -MODULE_VERSION(RTL8125_VERSION); +MODULE_VERSION(RTL8126_VERSION); /* #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -static void rtl8125_esd_timer(unsigned long __opaque); +static void rtl8126_esd_timer(unsigned long __opaque); #else -static void rtl8125_esd_timer(struct timer_list *t); +static void rtl8126_esd_timer(struct timer_list *t); #endif */ /* #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -static void rtl8125_link_timer(unsigned long __opaque); +static void rtl8126_link_timer(unsigned long __opaque); #else -static void rtl8125_link_timer(struct timer_list *t); +static void rtl8126_link_timer(struct timer_list *t); #endif */ -static netdev_tx_t rtl8125_start_xmit(struct sk_buff *skb, struct net_device *dev); +static netdev_tx_t rtl8126_start_xmit(struct sk_buff *skb, struct net_device *dev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t rtl8126_interrupt(int irq, void *dev_instance, struct pt_regs *regs); #else -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance); +static irqreturn_t rtl8126_interrupt(int irq, void *dev_instance); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t rtl8126_interrupt_msix(int irq, void *dev_instance, struct pt_regs *regs); #else -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance); +static irqreturn_t rtl8126_interrupt_msix(int irq, void *dev_instance); #endif -static void rtl8125_set_rx_mode(struct net_device *dev); +static void rtl8126_set_rx_mode(struct net_device *dev); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -static void rtl8125_tx_timeout(struct net_device *dev, unsigned int txqueue); +static void rtl8126_tx_timeout(struct net_device *dev, unsigned int txqueue); #else -static void rtl8125_tx_timeout(struct net_device *dev); +static void rtl8126_tx_timeout(struct net_device *dev); #endif -static int rtl8125_rx_interrupt(struct net_device *, struct rtl8125_private *, struct rtl8125_rx_ring *, napi_budget); -static int rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget); -static int rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, const int message_id, int budget); -static void rtl8125_wait_for_quiescence(struct net_device *dev); -static int rtl8125_change_mtu(struct net_device *dev, int new_mtu); -static void rtl8125_down(struct net_device *dev); +static int rtl8126_rx_interrupt(struct net_device *, struct rtl8126_private *, struct rtl8126_rx_ring *, napi_budget); +static int rtl8126_tx_interrupt(struct rtl8126_tx_ring *ring, int budget); +static int rtl8126_tx_interrupt_with_vector(struct rtl8126_private *tp, const int message_id, int budget); +static void rtl8126_wait_for_quiescence(struct net_device *dev); +static int rtl8126_change_mtu(struct net_device *dev, int new_mtu); +static void rtl8126_down(struct net_device *dev); -static int rtl8125_set_mac_address(struct net_device *dev, void *p); -static void rtl8125_rar_set(struct rtl8125_private *tp, const u8 *addr); -static void rtl8125_desc_addr_fill(struct rtl8125_private *); -static void rtl8125_tx_desc_init(struct rtl8125_private *tp); -static void rtl8125_rx_desc_init(struct rtl8125_private *tp); +static int rtl8126_set_mac_address(struct net_device *dev, void *p); +static void rtl8126_rar_set(struct rtl8126_private *tp, const u8 *addr); +static void rtl8126_desc_addr_fill(struct rtl8126_private *); +static void rtl8126_tx_desc_init(struct rtl8126_private *tp); +static void rtl8126_rx_desc_init(struct rtl8126_private *tp); -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 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 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 bool rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp); -static bool rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp); +static void rtl8126_mdio_direct_write_phy_ocp(struct rtl8126_private *tp, u16 RegAddr,u16 value); +static u32 rtl8126_mdio_direct_read_phy_ocp(struct rtl8126_private *tp, u16 RegAddr); +static void rtl8126_clear_and_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 clearmask, u16 setmask); +static void rtl8126_clear_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask); +static void rtl8126_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask); +static u16 rtl8126_get_hw_phy_mcu_code_ver(struct rtl8126_private *tp); +static void rtl8126_phy_power_up(struct net_device *dev); +static void rtl8126_phy_power_down(struct net_device *dev); +static int rtl8126_set_speed(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, u64 adv); +static bool rtl8126_set_phy_mcu_patch_request(struct rtl8126_private *tp); +static bool rtl8126_clear_phy_mcu_patch_request(struct rtl8126_private *tp); -#ifdef CONFIG_R8125_NAPI -static int rtl8125_poll(napi_ptr napi, napi_budget budget); +#ifdef CONFIG_R8126_NAPI +static int rtl8126_poll(napi_ptr napi, napi_budget budget); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_reset_task(void *_data); -static void rtl8125_esd_task(void *_data); -static void rtl8125_linkchg_task(void *_data); +static void rtl8126_reset_task(void *_data); +static void rtl8126_esd_task(void *_data); +static void rtl8126_linkchg_task(void *_data); #else -static void rtl8125_reset_task(struct work_struct *work); -static void rtl8125_esd_task(struct work_struct *work); -static void rtl8125_linkchg_task(struct work_struct *work); +static void rtl8126_reset_task(struct work_struct *work); +static void rtl8126_esd_task(struct work_struct *work); +static void rtl8126_linkchg_task(struct work_struct *work); #endif -static void rtl8125_schedule_reset_work(struct rtl8125_private *tp); -static void rtl8125_schedule_esd_work(struct rtl8125_private *tp); -static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp); -static void rtl8125_init_all_schedule_work(struct rtl8125_private *tp); -static void rtl8125_cancel_all_schedule_work(struct rtl8125_private *tp); +static void rtl8126_schedule_reset_work(struct rtl8126_private *tp); +static void rtl8126_schedule_esd_work(struct rtl8126_private *tp); +static void rtl8126_schedule_linkchg_work(struct rtl8126_private *tp); +static void rtl8126_init_all_schedule_work(struct rtl8126_private *tp); +static void rtl8126_cancel_all_schedule_work(struct rtl8126_private *tp); -static inline struct device *tp_to_dev(struct rtl8125_private *tp) +static inline struct device *tp_to_dev(struct rtl8126_private *tp) { return &tp->pci_dev->dev; } @@ -694,17 +631,11 @@ static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) } #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7) -static u32 rtl8125_read_thermal_sensor(struct rtl8125_private *tp) +static u32 rtl8126_read_thermal_sensor(struct rtl8126_private *tp) { u16 ts_digout; switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - ts_digout = mdio_direct_read_phy_ocp(tp, 0xBD84); - ts_digout &= 0x3ff; - break; default: ts_digout = 0xffff; break; @@ -713,7 +644,7 @@ static u32 rtl8125_read_thermal_sensor(struct rtl8125_private *tp) return ts_digout; } -int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr) +int rtl8126_dump_tally_counter(struct rtl8126_private *tp, dma_addr_t paddr) { u32 cmd; u32 WaitCnt; @@ -739,17 +670,57 @@ int rtl8125_dump_tally_counter(struct rtl8125_private *tp, dma_addr_t paddr) return retval; } -static bool -rtl8125_sysfs_testmode_on(struct rtl8125_private *tp) +static u32 +rtl8126_get_hw_clo_ptr(struct rtl8126_tx_ring *ring) { -#ifdef ENABLE_R8125_SYSFS + struct rtl8126_private *tp = ring->priv; + + 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 +rtl8126_get_sw_tail_ptr(struct rtl8126_tx_ring *ring) +{ + struct rtl8126_private *tp = ring->priv; + + 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 +rtl8126_sysfs_testmode_on(struct rtl8126_private *tp) +{ +#ifdef ENABLE_R8126_SYSFS return !!tp->testmode; #else return 1; #endif } -static u32 rtl8125_convert_link_speed(u16 status) +static u32 rtl8126_convert_link_speed(u16 status) { u32 speed = SPEED_UNKNOWN; @@ -769,33 +740,23 @@ static u32 rtl8125_convert_link_speed(u16 status) return speed; } -static void rtl8125_mdi_swap(struct rtl8125_private *tp) +static void rtl8126_mdi_swap(struct rtl8126_private *tp) { int i; u16 reg, val, mdi_reverse; u16 tps_p0, tps_p1, tps_p2, tps_p3, tps_p3_p0; switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - reg = 0x8284; - break; - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - reg = 0x81aa; - break; default: return; }; - tps_p3_p0 = rtl8125_mac_ocp_read(tp, 0xD440) & 0xF000; + tps_p3_p0 = rtl8126_mac_ocp_read(tp, 0xD440) & 0xF000; tps_p3 = !!(tps_p3_p0 & BIT_15); tps_p2 = !!(tps_p3_p0 & BIT_14); tps_p1 = !!(tps_p3_p0 & BIT_13); tps_p0 = !!(tps_p3_p0 & BIT_12); - mdi_reverse = rtl8125_mac_ocp_read(tp, 0xD442); + mdi_reverse = rtl8126_mac_ocp_read(tp, 0xD442); if ((mdi_reverse & BIT_5) && tps_p3_p0 == 0xA000) return; @@ -812,30 +773,30 @@ static void rtl8125_mdi_swap(struct rtl8125_private *tp) tps_p0 << 11; for (i=8; i<12; i++) { - mdio_direct_write_phy_ocp(tp, 0xA436, reg); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, reg); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, BIT(i), val & BIT(i)); } } -static int rtl8125_vcd_test(struct rtl8125_private *tp) +static int rtl8126_vcd_test(struct rtl8126_private *tp) { u16 val; u32 wait_cnt; int ret = -1; - rtl8125_mdi_swap(tp); + rtl8126_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)); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA422, BIT(0)); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA422, 0x00F0); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA422, BIT(0)); wait_cnt = 0; do { mdelay(1); - val = mdio_direct_read_phy_ocp(tp, 0xA422); + val = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA422); wait_cnt++; } while (!(val & BIT_15) && (wait_cnt < 5000)); @@ -848,113 +809,106 @@ exit: return ret; } -static void rtl8125_get_cp_len(struct rtl8125_private *tp, - u16 cp_len[RTL8125_CP_NUM]) +static void rtl8126_get_cp_len(struct rtl8126_private *tp, + int cp_len[RTL8126_CP_NUM]) { int i; u16 status; - u16 tmp_cp_len = 0; + int tmp_cp_len; status = RTL_R16(tp, PHYstatus); if (status & LinkStatus) { if (status & _10bps) { - tmp_cp_len = 0; + tmp_cp_len = -1; } else if (status & (_100bps | _1000bpsF)) { - rtl8125_mdio_write(tp, 0x1f, 0x0a88); - tmp_cp_len = rtl8125_mdio_read(tp, 0x10); + rtl8126_mdio_write(tp, 0x1f, 0x0a88); + tmp_cp_len = rtl8126_mdio_read(tp, 0x10); } else if (status & _2500bpsF) { switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_mdio_write(tp, 0x1f, 0x0ac5); - tmp_cp_len = rtl8125_mdio_read(tp, 0x14); - tmp_cp_len >>= 4; - break; default: - rtl8125_mdio_write(tp, 0x1f, 0x0acb); - tmp_cp_len = rtl8125_mdio_read(tp, 0x15); + rtl8126_mdio_write(tp, 0x1f, 0x0acb); + tmp_cp_len = rtl8126_mdio_read(tp, 0x15); tmp_cp_len >>= 2; break; } } else - goto exit; + tmp_cp_len = 0; } else - goto exit; + tmp_cp_len = 0; - tmp_cp_len &= 0xff; - for (i=0; i 0) + tmp_cp_len &= 0xff; + for (i=0; i RTL8125_MAX_SUPPORT_CP_LEN) - cp_len[i] = RTL8125_MAX_SUPPORT_CP_LEN; + for (i=0; i RTL8126_MAX_SUPPORT_CP_LEN) + cp_len[i] = RTL8126_MAX_SUPPORT_CP_LEN; return; } -static int __rtl8125_get_cp_status(u16 val) +static int __rtl8126_get_cp_status(u16 val) { switch (val) { case 0x0060: - return rtl8125_cp_normal; + return rtl8126_cp_normal; case 0x0048: - return rtl8125_cp_open; + return rtl8126_cp_open; case 0x0050: - return rtl8125_cp_short; + return rtl8126_cp_short; case 0x0042: case 0x0044: - return rtl8125_cp_mismatch; + return rtl8126_cp_mismatch; default: - return rtl8125_cp_normal; + return rtl8126_cp_normal; } } -static int _rtl8125_get_cp_status(struct rtl8125_private *tp, u8 pair_num) +static int _rtl8126_get_cp_status(struct rtl8126_private *tp, u8 pair_num) { u16 val; - int cp_status = rtl8125_cp_unknown; + int cp_status = rtl8126_cp_unknown; if (pair_num > 3) goto exit; - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8027 + 4 * pair_num); - val = mdio_direct_read_phy_ocp(tp, 0xA438); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8027 + 4 * pair_num); + val = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA438); - cp_status = __rtl8125_get_cp_status(val); + cp_status = __rtl8126_get_cp_status(val); exit: return cp_status; } -static const char * rtl8125_get_cp_status_string(int cp_status) +static const char * rtl8126_get_cp_status_string(int cp_status) { switch(cp_status) { - case rtl8125_cp_normal: + case rtl8126_cp_normal: return "normal "; - case rtl8125_cp_short: + case rtl8126_cp_short: return "short "; - case rtl8125_cp_open: + case rtl8126_cp_open: return "open "; - case rtl8125_cp_mismatch: + case rtl8126_cp_mismatch: return "mismatch"; default: return "unknown "; } } -static u16 rtl8125_get_cp_pp(struct rtl8125_private *tp, u8 pair_num) +static u16 rtl8126_get_cp_pp(struct rtl8126_private *tp, u8 pair_num) { u16 pp = 0; if (pair_num > 3) goto exit; - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8029 + 4 * pair_num); - pp = mdio_direct_read_phy_ocp(tp, 0xA438); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8029 + 4 * pair_num); + pp = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA438); pp &= 0x3fff; pp /= 80; @@ -963,29 +917,47 @@ exit: return pp; } -static void rtl8125_get_cp_status(struct rtl8125_private *tp, - int cp_status[RTL8125_CP_NUM]) +static void rtl8126_get_cp_status(struct rtl8126_private *tp, + int cp_status[RTL8126_CP_NUM], + bool poe_mode) { + u16 status; int i; - for (i=0; i= KERNEL_VERSION(3,10,0) static int proc_get_driver_variable(struct seq_file *m, void *v) { struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); seq_puts(m, "\nDump Driver Variable\n"); @@ -993,7 +965,7 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) seq_puts(m, "Variable\tValue\n----------\t-----\n"); seq_printf(m, "MODULENAME\t%s\n", MODULENAME); - seq_printf(m, "driver version\t%s\n", RTL8125_VERSION); + seq_printf(m, "driver version\t%s\n", RTL8126_VERSION); seq_printf(m, "mcfg\t%d\n", tp->mcfg); seq_printf(m, "chipset\t%d\n", tp->chipset); seq_printf(m, "chipset_name\t%s\n", rtl_chip_info[tp->chipset].name); @@ -1020,7 +992,7 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) #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); + seq_printf(m, "rtl8126_rx_config\t0x%x\n", tp->rtl8126_rx_config); seq_printf(m, "cp_cmd\t0x%x\n", tp->cp_cmd); seq_printf(m, "intr_mask\t0x%x\n", tp->intr_mask); seq_printf(m, "timer_intr_mask\t0x%x\n", tp->timer_intr_mask); @@ -1067,7 +1039,6 @@ 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); @@ -1087,18 +1058,18 @@ 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", RTL_R16(tp, tp->tx_ring[0].hw_clo_ptr_reg)); - seq_printf(m, "sw_tail_ptr_reg0\t0x%x\n", RTL_R16(tp, tp->tx_ring[0].sw_tail_ptr_reg)); + seq_printf(m, "hw_clo_ptr_reg0\t0x%x\n", rtl8126_get_hw_clo_ptr(&tp->tx_ring[0])); + seq_printf(m, "sw_tail_ptr_reg0\t0x%x\n", rtl8126_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", RTL_R16(tp, tp->tx_ring[1].hw_clo_ptr_reg)); - seq_printf(m, "sw_tail_ptr_reg1\t0x%x\n", RTL_R16(tp, tp->tx_ring[1].sw_tail_ptr_reg)); + seq_printf(m, "hw_clo_ptr_reg1\t0x%x\n", rtl8126_get_hw_clo_ptr(&tp->tx_ring[1])); + seq_printf(m, "sw_tail_ptr_reg1\t0x%x\n", rtl8126_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, "tot_rx_rings\t0x%x\n", rtl8126_tot_rx_rings(tp)); + seq_printf(m, "tot_tx_rings\t0x%x\n", rtl8126_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); @@ -1130,8 +1101,8 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) static int proc_get_tally_counter(struct seq_file *m, void *v) { struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters; + struct rtl8126_private *tp = netdev_priv(dev); + struct rtl8126_counters *counters; dma_addr_t paddr; seq_puts(m, "\nDump Tally Counter\n"); @@ -1145,7 +1116,7 @@ static int proc_get_tally_counter(struct seq_file *m, void *v) goto out_unlock; } - rtl8125_dump_tally_counter(tp, paddr); + rtl8126_dump_tally_counter(tp, paddr); seq_puts(m, "Statistics\tValue\n----------\t-----\n"); seq_printf(m, "tx_packets\t%lld\n", le64_to_cpu(counters->tx_packets)); @@ -1200,9 +1171,9 @@ out_unlock: static int proc_get_registers(struct seq_file *m, void *v) { struct net_device *dev = m->private; - int i, n, max = R8125_MAC_REGS_SIZE; + int i, n, max = R8126_MAC_REGS_SIZE; u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; seq_puts(m, "\nDump MAC Registers\n"); @@ -1260,7 +1231,7 @@ 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); + struct rtl8126_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; struct pci_dev *pdev = tp->pci_dev; @@ -1291,9 +1262,9 @@ static int proc_get_all_registers(struct seq_file *m, void *v) static int proc_get_pcie_phy(struct seq_file *m, void *v) { struct net_device *dev = m->private; - int i, n, max = R8125_EPHY_REGS_SIZE/2; + int i, n, max = R8126_EPHY_REGS_SIZE/2; u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); seq_puts(m, "\nDump PCIE PHY\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); @@ -1304,7 +1275,7 @@ static int proc_get_pcie_phy(struct seq_file *m, void *v) seq_printf(m, "\n0x%02x:\t", n); for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_ephy_read(tp, n); + word_rd = rtl8126_ephy_read(tp, n); seq_printf(m, "%04x ", word_rd); } } @@ -1318,9 +1289,9 @@ static int proc_get_pcie_phy(struct seq_file *m, void *v) static int proc_get_eth_phy(struct seq_file *m, void *v) { struct net_device *dev = m->private; - int i, n, max = R8125_PHY_REGS_SIZE/2; + int i, n, max = R8126_PHY_REGS_SIZE/2; u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); seq_puts(m, "\nDump Ethernet PHY\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); @@ -1328,16 +1299,55 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) rtnl_lock(); seq_puts(m, "\n####################page 0##################\n "); - rtl8125_mdio_write(tp, 0x1f, 0x0000); + rtl8126_mdio_write(tp, 0x1f, 0x0000); for (n = 0; n < max;) { seq_printf(m, "\n0x%02x:\t", n); for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_mdio_read(tp, n); + word_rd = rtl8126_mdio_read(tp, n); seq_printf(m, "%04x ", word_rd); } } + 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 = rtl8126_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 = rtl8126_mdio_direct_read_phy_ocp(tp, n); + seq_printf(m, "%04x ", word_rd); + } + + n = 0xA434; + seq_printf(m, "\n0x%02x:\t", n); + word_rd = rtl8126_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 = rtl8126_mdio_direct_read_phy_ocp(tp, n); + seq_printf(m, "%04x ", word_rd); + } + + n = 0xA61A; + seq_printf(m, "\n0x%02x:\t", n); + word_rd = rtl8126_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 = rtl8126_mdio_direct_read_phy_ocp(tp, n); + seq_printf(m, "%04x ", word_rd); + } + rtnl_unlock(); seq_putc(m, '\n'); @@ -1347,9 +1357,9 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) static int proc_get_extended_registers(struct seq_file *m, void *v) { struct net_device *dev = m->private; - int i, n, max = R8125_ERI_REGS_SIZE; + int i, n, max = R8126_ERI_REGS_SIZE; u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); seq_puts(m, "\nDump Extended Registers\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); @@ -1360,7 +1370,7 @@ static int proc_get_extended_registers(struct seq_file *m, void *v) seq_printf(m, "\n0x%02x:\t", n); for (i = 0; i < 4 && n < max; i++, n+=4) { - dword_rd = rtl8125_eri_read(tp, n, 4, ERIAR_ExGMAC); + dword_rd = rtl8126_eri_read(tp, n, 4, ERIAR_ExGMAC); seq_printf(m, "%08x ", dword_rd); } } @@ -1374,9 +1384,9 @@ static int proc_get_extended_registers(struct seq_file *m, void *v) static int proc_get_pci_registers(struct seq_file *m, void *v) { struct net_device *dev = m->private; - int i, n, max = R8125_PCI_REGS_SIZE; + int i, n, max = R8126_PCI_REGS_SIZE; u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); seq_puts(m, "\nDump PCI Registers\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); @@ -1408,29 +1418,24 @@ static int proc_get_pci_registers(struct seq_file *m, void *v) static int proc_get_temperature(struct seq_file *m, void *v) { struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 ts_digout, tj, fah; switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - seq_puts(m, "\nChip Temperature\n"); - break; default: return -EOPNOTSUPP; } rtnl_lock(); - if (!rtl8125_sysfs_testmode_on(tp)) { + if (!rtl8126_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); + ts_digout = rtl8126_read_thermal_sensor(tp); netif_testing_off(dev); rtnl_unlock(); @@ -1452,21 +1457,18 @@ 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) +static int _proc_get_cable_info(struct seq_file *m, void *v, bool poe_mode) { int i; u16 status; - int cp_status[RTL8125_CP_NUM]; - u16 cp_len[RTL8125_CP_NUM] = {0}; + int cp_status[RTL8126_CP_NUM]; + int cp_len[RTL8126_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"}; + struct rtl8126_private *tp = netdev_priv(dev); + const char *pair_str[RTL8126_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; @@ -1474,14 +1476,14 @@ static int proc_get_cable_info(struct seq_file *m, void *v) rtnl_lock(); - if (!rtl8125_sysfs_testmode_on(tp)) { + if (!rtl8126_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) { + rtl8126_mdio_write(tp, 0x1F, 0x0000); + if (rtl8126_mdio_read(tp, MII_BMCR) & BMCR_PDOWN) { ret = -EIO; goto error_unlock; } @@ -1491,32 +1493,29 @@ static int proc_get_cable_info(struct seq_file *m, void *v) status = RTL_R16(tp, PHYstatus); if (status & LinkStatus) seq_printf(m, "\nlink speed:%d", - rtl8125_convert_link_speed(status)); + rtl8126_convert_link_speed(status)); else seq_puts(m, "\nlink status:off"); - rtl8125_get_cp_len(tp, cp_len); + rtl8126_get_cp_len(tp, cp_len); - if (tp->link_ok(dev)) { - for (i=0; iprivate; - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_rx_ring *ring = &tp->rx_ring[0]; - - if (!ring) - return -EOPNOTSUPP; + struct rtl8126_private *tp = netdev_priv(dev); + int i; rtnl_lock(); - seq_printf(m, "\ndump rx desc:%d\n", ring->num_rx_desc); + for (i = 0; i < tp->num_rx_rings; i++) { + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; - _proc_dump_desc(m, (void*)ring->RxDescArray, ring->RxDescAllocSize); + if (!ring) + continue; + + seq_printf(m, "\ndump rx %d desc:%d\n", i, ring->num_rx_desc); + + _proc_dump_desc(m, (void*)ring->RxDescArray, ring->RxDescAllocSize); + } #ifdef ENABLE_LIB_SUPPORT - if (rtl8125_num_lib_rx_rings(tp) > 0) { - int i; - + if (rtl8126_num_lib_rx_rings(tp) > 0) { for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - struct rtl8125_ring *lib_ring = &tp->lib_rx_ring[i]; - if(lib_ring->enabled) { + struct rtl8126_ring *lib_ring = &tp->lib_rx_ring[i]; + 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, @@ -1592,25 +1603,27 @@ static int proc_dump_rx_desc(struct seq_file *m, void *v) 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); - struct rtl8125_tx_ring *ring = &tp->tx_ring[0]; - - if (!ring) - return -EOPNOTSUPP; + struct rtl8126_private *tp = netdev_priv(dev); + int i; rtnl_lock(); - seq_printf(m, "\ndump tx desc:%d\n", ring->num_tx_desc); + for (i = 0; i < tp->num_tx_rings; i++) { + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; - _proc_dump_desc(m, (void*)ring->TxDescArray, ring->TxDescAllocSize); + if (!ring) + continue; + + seq_printf(m, "\ndump tx %d desc:%d\n", i, ring->num_tx_desc); + + _proc_dump_desc(m, (void*)ring->TxDescArray, ring->TxDescAllocSize); + } #ifdef ENABLE_LIB_SUPPORT - if (rtl8125_num_lib_tx_rings(tp) > 0) { - int i; - + if (rtl8126_num_lib_tx_rings(tp) > 0) { for (i = 0; i < tp->HwSuppNumTxQueues; i++) { - struct rtl8125_ring *lib_ring = &tp->lib_tx_ring[i]; - if(lib_ring->enabled) { + struct rtl8126_ring *lib_ring = &tp->lib_tx_ring[i]; + 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, @@ -1629,24 +1642,30 @@ 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; struct net_device *dev = m->private; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_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->max_irq_nvecs); + seq_printf(m, "\ndump MSI-X Table. Total Entry %d. \n", tp->hw_supp_irq_nvecs); for (i=0; ihw_supp_irq_nvecs; i++) { seq_printf(m, "\n%04x ", i); for (j=0; j<4; j++) seq_printf(m, "%08x ", - rtl8125_eri_read( - tp, i*0x10 + 4 * j, 4, - ERIAR_MSIX)); + readl(ioaddr + i*0x10 + 4*j)); } rtnl_unlock(); + iounmap(ioaddr); + seq_putc(m, '\n'); return 0; } @@ -1658,7 +1677,7 @@ static int proc_get_driver_variable(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int len = 0; len += snprintf(page + len, count - len, @@ -1698,7 +1717,7 @@ static int proc_get_driver_variable(char *page, char **start, #endif //ENABLE_PAGE_REUSE "esd_flag\t0x%x\n" "pci_cfg_is_read\t0x%x\n" - "rtl8125_rx_config\t0x%x\n" + "rtl8126_rx_config\t0x%x\n" "cp_cmd\t0x%x\n" "intr_mask\t0x%x\n" "timer_intr_mask\t0x%x\n" @@ -1745,7 +1764,6 @@ 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" @@ -1799,7 +1817,7 @@ static int proc_get_driver_variable(char *page, char **start, #endif "dev_addr\t%pM\n", MODULENAME, - RTL8125_VERSION, + RTL8126_VERSION, tp->mcfg, tp->chipset, rtl_chip_info[tp->chipset].name, @@ -1826,7 +1844,7 @@ static int proc_get_driver_variable(char *page, char **start, #endif //ENABLE_PAGE_REUSE tp->esd_flag, tp->pci_cfg_is_read, - tp->rtl8125_rx_config, + tp->rtl8126_rx_config, tp->cp_cmd, tp->intr_mask, tp->timer_intr_mask, @@ -1873,7 +1891,6 @@ static int proc_get_driver_variable(char *page, char **start, speed_mode, duplex_mode, autoneg_mode, - advertising_mode, aspm, s5wol, s5_keep_curr_mac, @@ -1893,18 +1910,18 @@ static int proc_get_driver_variable(char *page, char **start, tp->EnableTxNoClose, tp->tx_ring[0].NextHwDesCloPtr, tp->tx_ring[0].BeginHwDesCloPtr, - RTL_R16(tp, tp->tx_ring[0].hw_clo_ptr_reg), - RTL_R16(tp, tp->tx_ring[0].sw_tail_ptr_reg), + rtl8126_get_hw_clo_ptr(&tp->tx_ring[0]), + rtl8126_get_sw_tail_ptr(&tp->tx_ring[0]), tp->tx_ring[1].NextHwDesCloPtr, tp->tx_ring[1].BeginHwDesCloPtr, - RTL_R16(tp, tp->tx_ring[1].hw_clo_ptr_reg), - RTL_R16(tp, tp->tx_ring[1].sw_tail_ptr_reg), + rtl8126_get_hw_clo_ptr(&tp->tx_ring[1]), + rtl8126_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), + rtl8126_tot_rx_rings(tp), + rtl8126_tot_tx_rings(tp), tp->HwSuppNumRxQueues, tp->HwSuppNumTxQueues, tp->EnableRss, @@ -1941,8 +1958,8 @@ static int proc_get_tally_counter(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters; + struct rtl8126_private *tp = netdev_priv(dev); + struct rtl8126_counters *counters; dma_addr_t paddr; int len = 0; @@ -1959,7 +1976,7 @@ static int proc_get_tally_counter(char *page, char **start, goto out_unlock; } - rtl8125_dump_tally_counter(tp, paddr); + rtl8126_dump_tally_counter(tp, paddr); len += snprintf(page + len, count - len, "Statistics\tValue\n----------\t-----\n"); @@ -2060,9 +2077,9 @@ static int proc_get_registers(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - int i, n, max = R8125_MAC_REGS_SIZE; + int i, n, max = R8126_MAC_REGS_SIZE; u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; int len = 0; @@ -2142,7 +2159,7 @@ static int proc_get_all_registers(char *page, char **start, struct net_device *dev = data; int i, n, max; u8 byte_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; struct pci_dev *pdev = tp->pci_dev; int len = 0; @@ -2183,9 +2200,9 @@ static int proc_get_pcie_phy(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - int i, n, max = R8125_EPHY_REGS_SIZE/2; + int i, n, max = R8126_EPHY_REGS_SIZE/2; u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int len = 0; len += snprintf(page + len, count - len, @@ -2200,7 +2217,7 @@ static int proc_get_pcie_phy(char *page, char **start, n); for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_ephy_read(tp, n); + word_rd = rtl8126_ephy_read(tp, n); len += snprintf(page + len, count - len, "%04x ", word_rd); @@ -2220,9 +2237,9 @@ static int proc_get_eth_phy(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - int i, n, max = R8125_PHY_REGS_SIZE/2; + int i, n, max = R8126_PHY_REGS_SIZE/2; u16 word_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int len = 0; len += snprintf(page + len, count - len, @@ -2233,20 +2250,84 @@ static int proc_get_eth_phy(char *page, char **start, len += snprintf(page + len, count - len, "\n####################page 0##################\n"); - rtl8125_mdio_write(tp, 0x1f, 0x0000); + rtl8126_mdio_write(tp, 0x1f, 0x0000); for (n = 0; n < max;) { len += snprintf(page + len, count - len, "\n0x%02x:\t", n); for (i = 0; i < 8 && n < max; i++, n++) { - word_rd = rtl8125_mdio_read(tp, n); + word_rd = rtl8126_mdio_read(tp, n); len += snprintf(page + len, count - len, "%04x ", word_rd); } } + 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 = rtl8126_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 = rtl8126_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 = rtl8126_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 = rtl8126_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 = rtl8126_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 = rtl8126_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"); @@ -2260,9 +2341,9 @@ static int proc_get_extended_registers(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - int i, n, max = R8125_ERI_REGS_SIZE; + int i, n, max = R8126_ERI_REGS_SIZE; u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int len = 0; len += snprintf(page + len, count - len, @@ -2277,7 +2358,7 @@ static int proc_get_extended_registers(char *page, char **start, n); for (i = 0; i < 4 && n < max; i++, n+=4) { - dword_rd = rtl8125_eri_read(tp, n, 4, ERIAR_ExGMAC); + dword_rd = rtl8126_eri_read(tp, n, 4, ERIAR_ExGMAC); len += snprintf(page + len, count - len, "%08x ", dword_rd); @@ -2297,9 +2378,9 @@ static int proc_get_pci_registers(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - int i, n, max = R8125_PCI_REGS_SIZE; + int i, n, max = R8126_PCI_REGS_SIZE; u32 dword_rd; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int len = 0; len += snprintf(page + len, count - len, @@ -2347,30 +2428,24 @@ static int proc_get_temperature(char *page, char **start, int *eof, void *data) { struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 ts_digout, tj, fah; int len = 0; switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - len += snprintf(page + len, count - len, - "\nChip Temperature\n"); - break; default: return -EOPNOTSUPP; } rtnl_lock(); - if (!rtl8125_sysfs_testmode_on(tp)) { + if (!rtl8126_sysfs_testmode_on(tp)) { len += snprintf(page + len, count - len, "\nPlease turn on ""/sys/class/net//rtk_adv/testmode"".\n\n"); goto out_unlock; } - ts_digout = rtl8125_read_thermal_sensor(tp); + ts_digout = rtl8126_read_thermal_sensor(tp); tj = ts_digout / 2; if (ts_digout <= 512) { @@ -2405,28 +2480,26 @@ out_unlock: static int proc_get_cable_info(char *page, char **start, off_t offset, int count, - int *eof, void *data) + int *eof, void *data, + bool poe_mode) { int i; u16 status; int len = 0; struct net_device *dev = data; - int cp_status[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"}; + int cp_status[RTL8126_CP_NUM] = {0}; + int cp_len[RTL8126_CP_NUM] = {0}; + struct rtl8126_private *tp = netdev_priv(dev); + const char *pair_str[RTL8126_CP_NUM] = {"1-2", "3-6", "4-5", "7-8"}; switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_7: - /* support */ - break; default: return -EOPNOTSUPP; } rtnl_lock(); - if (!rtl8125_sysfs_testmode_on(tp)) { + if (!rtl8126_sysfs_testmode_on(tp)) { len += snprintf(page + len, count - len, "\nPlease turn on ""/sys/class/net//rtk_adv/testmode"".\n\n"); goto out_unlock; @@ -2436,36 +2509,34 @@ static int proc_get_cable_info(char *page, char **start, if (status & LinkStatus) len += snprintf(page + len, count - len, "\nlink speed:%d", - rtl8125_convert_link_speed(status)); + rtl8126_convert_link_speed(status)); else len += snprintf(page + len, count - len, "\nlink status:off"); - rtl8125_get_cp_len(tp, cp_len); + rtl8126_get_cp_len(tp, cp_len); - if (tp->link_ok(dev)) { - for (i=0; irx_ring[0]; - - if (!ring) - return -EOPNOTSUPP; + struct rtl8126_private *tp = netdev_priv(dev); rtnl_lock(); - len += snprintf(page + len, count - len, - "\ndump rx desc:%d", - ring->num_rx_desc); + for (i = 0; i < tp->num_rx_rings; i++) { + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; - _proc_dump_desc(page, &len, &count, - ring->RxDescArray, - ring->RxDescAllocSize); + if (!ring) + continue; + + len += snprintf(page + len, count - len, + "\ndump rx &d desc:%d", + i, ring->num_rx_desc); + + _proc_dump_desc(page, &len, &count, + ring->RxDescArray, + ring->RxDescAllocSize); + } #ifdef ENABLE_LIB_SUPPORT - if (rtl8125_num_lib_rx_rings(tp) > 0) { - int i; - + if (rtl8126_num_lib_rx_rings(tp) > 0) { for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - struct rtl8125_ring *lib_ring = &tp->lib_rx_ring[i]; - if(lib_ring->enabled) { + struct rtl8126_ring *lib_ring = &tp->lib_rx_ring[i]; + if (lib_ring->enabled) { len += snprintf(page + len, count - len, "\ndump lib rx %d desc:%d", i, @@ -2561,29 +2647,31 @@ 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); - struct rtl8125_tx_ring *ring = &tp->tx_ring[0]; - - if (!ring) - return -EOPNOTSUPP; + struct rtl8126_private *tp = netdev_priv(dev); + int i; rtnl_lock(); - len += snprintf(page + len, count - len, - "\ndump tx desc:%d", - ring->num_tx_desc); + for (i = 0; i < tp->num_tx_rings; i++) { + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; - _proc_dump_desc(page, &len, &count, - ring->TxDescArray, - ring->TxDescAllocSize); + if (!ring) + continue; + + len += snprintf(page + len, count - len, + "\ndump tx desc:%d", + ring->num_tx_desc); + + _proc_dump_desc(page, &len, &count, + ring->TxDescArray, + ring->TxDescAllocSize); + } #ifdef ENABLE_LIB_SUPPORT - if (rtl8125_num_lib_tx_rings(tp) > 0) { - int i; - + if (rtl8126_num_lib_tx_rings(tp) > 0) { for (i = 0; i < tp->HwSuppNumTxQueues; i++) { - struct rtl8125_ring *lib_ring = &tp->lib_tx_ring[i]; - if(lib_ring->enabled) { + struct rtl8126_ring *lib_ring = &tp->lib_tx_ring[i]; + if (lib_ring->enabled) { len += snprintf(page + len, count - len, "\ndump lib tx %d desc:%d", i, @@ -2611,22 +2699,27 @@ static int proc_dump_msix_tbl(char *page, char **start, { int i, j; int len = 0; + void __iomem *ioaddr; struct net_device *dev = data; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_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->max_irq_nvecs); + tp->hw_supp_irq_nvecs); for (i=0; ihw_supp_irq_nvecs; i++) { len += snprintf(page + len, count - len, "\n%04x ", i); for (j=0; j<4; j++) len += snprintf(page + len, count - len, "%08x ", - rtl8125_eri_read(tp, i*0x10 + 4*j, 4, - ERIAR_MSIX)); + readl(ioaddr + i*0x10 + 4*j)); } rtnl_unlock(); @@ -2639,15 +2732,15 @@ static int proc_dump_msix_tbl(char *page, char **start, #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) -static void rtl8125_proc_module_init(void) +static void rtl8126_proc_module_init(void) { - //create /proc/net/r8125 + //create /proc/net/r8126 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) - rtl8125_proc = proc_mkdir(MODULENAME, init_net.proc_net); + rtl8126_proc = proc_mkdir(MODULENAME, init_net.proc_net); #else - rtl8125_proc = proc_mkdir(MODULENAME, proc_net); + rtl8126_proc = proc_mkdir(MODULENAME, proc_net); #endif - if (!rtl8125_proc) + if (!rtl8126_proc) dprintk("cannot create %s proc entry \n", MODULENAME); } @@ -2655,7 +2748,7 @@ static void rtl8125_proc_module_init(void) /* * seq_file wrappers for procfile show routines. */ -static int rtl8125_proc_open(struct inode *inode, struct file *file) +static int rtl8126_proc_open(struct inode *inode, struct file *file) { struct net_device *dev = proc_get_parent_data(inode); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) @@ -2668,15 +2761,15 @@ static int rtl8125_proc_open(struct inode *inode, struct file *file) } #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -static const struct proc_ops rtl8125_proc_fops = { - .proc_open = rtl8125_proc_open, +static const struct proc_ops rtl8126_proc_fops = { + .proc_open = rtl8126_proc_open, .proc_read = seq_read, .proc_lseek = seq_lseek, .proc_release = single_release, }; #else -static const struct file_operations rtl8125_proc_fops = { - .open = rtl8125_proc_open, +static const struct file_operations rtl8126_proc_fops = { + .open = rtl8126_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, @@ -2688,7 +2781,7 @@ static const struct file_operations rtl8125_proc_fops = { /* * Table of proc files we need to create. */ -struct rtl8125_proc_file { +struct rtl8126_proc_file { char name[16]; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) int (*show)(struct seq_file *, void *); @@ -2697,7 +2790,7 @@ struct rtl8125_proc_file { #endif }; -static const struct rtl8125_proc_file rtl8125_debug_proc_files[] = { +static const struct rtl8126_proc_file rtl8126_debug_proc_files[] = { { "driver_var", &proc_get_driver_variable }, { "tally", &proc_get_tally_counter }, { "registers", &proc_get_registers }, @@ -2712,29 +2805,30 @@ static const struct rtl8125_proc_file rtl8125_debug_proc_files[] = { { "", NULL } }; -static const struct rtl8125_proc_file rtl8125_test_proc_files[] = { +static const struct rtl8126_proc_file rtl8126_test_proc_files[] = { { "temp", &proc_get_temperature }, { "cdt", &proc_get_cable_info }, + { "cdt_poe", &proc_get_poe_cable_info }, { "", NULL } }; -#define R8125_PROC_DEBUG_DIR "debug" -#define R8125_PROC_TEST_DIR "test" +#define R8126_PROC_DEBUG_DIR "debug" +#define R8126_PROC_TEST_DIR "test" -static void rtl8125_proc_init(struct net_device *dev) +static void rtl8126_proc_init(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); - const struct rtl8125_proc_file *f; + struct rtl8126_private *tp = netdev_priv(dev); + const struct rtl8126_proc_file *f; struct proc_dir_entry *dir; - if (!rtl8125_proc) + if (!rtl8126_proc) return; if (tp->proc_dir_debug || tp->proc_dir_test) return; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - dir = proc_mkdir_data(dev->name, 0, rtl8125_proc, dev); + dir = proc_mkdir_data(dev->name, 0, rtl8126_proc, dev); if (!dir) { printk("Unable to initialize /proc/net/%s/%s\n", MODULENAME, dev->name); @@ -2744,46 +2838,46 @@ static void rtl8125_proc_init(struct net_device *dev) proc_init_num++; /* create debug entry */ - dir = proc_mkdir_data(R8125_PROC_DEBUG_DIR, 0, tp->proc_dir, dev); + dir = proc_mkdir_data(R8126_PROC_DEBUG_DIR, 0, tp->proc_dir, dev); if (!dir) { printk("Unable to initialize /proc/net/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_DEBUG_DIR); + MODULENAME, dev->name, R8126_PROC_DEBUG_DIR); return; } tp->proc_dir_debug = dir; - for (f = rtl8125_debug_proc_files; f->name[0]; f++) { + for (f = rtl8126_debug_proc_files; f->name[0]; f++) { if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, - &rtl8125_proc_fops, f->show)) { + &rtl8126_proc_fops, f->show)) { printk("Unable to initialize " "/proc/net/%s/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_DEBUG_DIR, + MODULENAME, dev->name, R8126_PROC_DEBUG_DIR, f->name); return; } } /* create test entry */ - dir = proc_mkdir_data(R8125_PROC_TEST_DIR, 0, tp->proc_dir, dev); + dir = proc_mkdir_data(R8126_PROC_TEST_DIR, 0, tp->proc_dir, dev); if (!dir) { printk("Unable to initialize /proc/net/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_TEST_DIR); + MODULENAME, dev->name, R8126_PROC_TEST_DIR); return; } tp->proc_dir_test = dir; - for (f = rtl8125_test_proc_files; f->name[0]; f++) { + for (f = rtl8126_test_proc_files; f->name[0]; f++) { if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir, - &rtl8125_proc_fops, f->show)) { + &rtl8126_proc_fops, f->show)) { printk("Unable to initialize " "/proc/net/%s/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_TEST_DIR, + MODULENAME, dev->name, R8126_PROC_TEST_DIR, f->name); return; } } #else - dir = proc_mkdir(dev->name, rtl8125_proc); + dir = proc_mkdir(dev->name, rtl8126_proc); if (!dir) { printk("Unable to initialize /proc/net/%s/%s\n", MODULENAME, dev->name); @@ -2794,40 +2888,40 @@ static void rtl8125_proc_init(struct net_device *dev) proc_init_num++; /* create debug entry */ - dir = proc_mkdir(R8125_PROC_DEBUG_DIR, tp->proc_dir); + dir = proc_mkdir(R8126_PROC_DEBUG_DIR, tp->proc_dir); if (!dir) { printk("Unable to initialize /proc/net/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_DEBUG_DIR); + MODULENAME, dev->name, R8126_PROC_DEBUG_DIR); return; } tp->proc_dir_debug = dir; - for (f = rtl8125_debug_proc_files; f->name[0]; f++) { + for (f = rtl8126_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 " "/proc/net/%s/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_DEBUG_DIR, + MODULENAME, dev->name, R8126_PROC_DEBUG_DIR, f->name); return; } } /* create test entry */ - dir = proc_mkdir(R8125_PROC_TEST_DIR, tp->proc_dir); + dir = proc_mkdir(R8126_PROC_TEST_DIR, tp->proc_dir); if (!dir) { printk("Unable to initialize /proc/net/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_TEST_DIR); + MODULENAME, dev->name, R8126_PROC_TEST_DIR); return; } tp->proc_dir_test = dir; - for (f = rtl8125_test_proc_files; f->name[0]; f++) { + for (f = rtl8126_test_proc_files; f->name[0]; f++) { if (!create_proc_read_entry(f->name, S_IFREG | S_IRUGO, dir, f->show, dev)) { printk("Unable to initialize " "/proc/net/%s/%s/%s/%s\n", - MODULENAME, dev->name, R8125_PROC_TEST_DIR, + MODULENAME, dev->name, R8126_PROC_TEST_DIR, f->name); return; } @@ -2835,30 +2929,30 @@ static void rtl8125_proc_init(struct net_device *dev) #endif } -static void rtl8125_proc_remove(struct net_device *dev) +static void rtl8126_proc_remove(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (tp->proc_dir) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - remove_proc_subtree(dev->name, rtl8125_proc); + remove_proc_subtree(dev->name, rtl8126_proc); #else - const struct rtl8125_proc_file *f; - struct rtl8125_private *tp = netdev_priv(dev); + const struct rtl8126_proc_file *f; + struct rtl8126_private *tp = netdev_priv(dev); if (tp->proc_dir_debug) { - for (f = rtl8125_debug_proc_files; f->name[0]; f++) + for (f = rtl8126_debug_proc_files; f->name[0]; f++) remove_proc_entry(f->name, tp->proc_dir_debug); - remove_proc_entry(R8125_PROC_DEBUG_DIR, tp->proc_dir); + remove_proc_entry(R8126_PROC_DEBUG_DIR, tp->proc_dir); } if (tp->proc_dir_test) { - for (f = rtl8125_test_proc_files; f->name[0]; f++) + for (f = rtl8126_test_proc_files; f->name[0]; f++) remove_proc_entry(f->name, tp->proc_dir_test); - remove_proc_entry(R8125_PROC_TEST_DIR, tp->proc_dir); + remove_proc_entry(R8126_PROC_TEST_DIR, tp->proc_dir); } - remove_proc_entry(dev->name, rtl8125_proc); + remove_proc_entry(dev->name, rtl8126_proc); #endif proc_init_num--; @@ -2868,9 +2962,9 @@ static void rtl8125_proc_remove(struct net_device *dev) } } -#endif //ENABLE_R8125_PROCFS +#endif //ENABLE_R8126_PROCFS -#ifdef ENABLE_R8125_SYSFS +#ifdef ENABLE_R8126_SYSFS /**************************************************************************** * -----------------------------SYSFS STUFF------------------------- ***************************************************************************** @@ -2879,7 +2973,7 @@ 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); + struct rtl8126_private *tp = netdev_priv(netdev); sprintf(buf, "%u\n", tp->testmode); @@ -2891,7 +2985,7 @@ static ssize_t testmode_store(struct device *dev, const char *buf, size_t count) { struct net_device *netdev = to_net_dev(dev); - struct rtl8125_private *tp = netdev_priv(netdev); + struct rtl8126_private *tp = netdev_priv(netdev); u32 testmode; if (sscanf(buf, "%u\n", &testmode) != 1) @@ -2918,9 +3012,9 @@ static struct attribute_group rtk_adv_grp = { .attrs = rtk_adv_attrs, }; -static void rtl8125_sysfs_init(struct net_device *dev) +static void rtl8126_sysfs_init(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ret; /* init rtl_adv */ @@ -2934,17 +3028,17 @@ static void rtl8125_sysfs_init(struct net_device *dev) if (ret < 0) netif_warn(tp, probe, dev, "create rtk_adv_grp fail\n"); else - set_bit(R8125_SYSFS_RTL_ADV, tp->sysfs_flag); + set_bit(R8126_SYSFS_RTL_ADV, tp->sysfs_flag); } -static void rtl8125_sysfs_remove(struct net_device *dev) +static void rtl8126_sysfs_remove(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (test_and_clear_bit(R8125_SYSFS_RTL_ADV, tp->sysfs_flag)) + if (test_and_clear_bit(R8126_SYSFS_RTL_ADV, tp->sysfs_flag)) sysfs_remove_group(&dev->dev.kobj, &rtk_adv_grp); } -#endif //ENABLE_R8125_SYSFS +#endif //ENABLE_R8126_SYSFS static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum) { @@ -2952,9 +3046,9 @@ static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum) 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; @@ -2962,7 +3056,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; @@ -2975,7 +3069,7 @@ static inline u16 map_phy_ocp_addr(u16 PageNum, u8 RegNum) return OcpPhyAddress; } -static void mdio_real_direct_write_phy_ocp(struct rtl8125_private *tp, +static void mdio_real_direct_write_phy_ocp(struct rtl8126_private *tp, u16 RegAddr, u16 value) { @@ -2990,25 +3084,26 @@ static void mdio_real_direct_write_phy_ocp(struct rtl8125_private *tp, data32 |= OCPR_Write | value; RTL_W32(tp, PHYOCP, data32); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); if (!(RTL_R32(tp, PHYOCP) & OCPR_Flag)) break; } } -static void mdio_direct_write_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr, - u16 value) +static void rtl8126_mdio_direct_write_phy_ocp(struct rtl8126_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); } /* -static void rtl8125_mdio_write_phy_ocp(struct rtl8125_private *tp, +static void rtl8126_mdio_write_phy_ocp(struct rtl8126_private *tp, u16 PageNum, u32 RegAddr, u32 value) @@ -3017,11 +3112,11 @@ static void rtl8125_mdio_write_phy_ocp(struct rtl8125_private *tp, ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - mdio_direct_write_phy_ocp(tp, ocp_addr, value); + rtl8126_mdio_direct_write_phy_ocp(tp, ocp_addr, value); } */ -static void rtl8125_mdio_real_write_phy_ocp(struct rtl8125_private *tp, +static void rtl8126_mdio_real_write_phy_ocp(struct rtl8126_private *tp, u16 PageNum, u32 RegAddr, u32 value) @@ -3033,7 +3128,7 @@ static void rtl8125_mdio_real_write_phy_ocp(struct rtl8125_private *tp, mdio_real_direct_write_phy_ocp(tp, ocp_addr, value); } -static void mdio_real_write(struct rtl8125_private *tp, +static void mdio_real_write(struct rtl8126_private *tp, u16 RegAddr, u16 value) { @@ -3041,33 +3136,34 @@ static void mdio_real_write(struct rtl8125_private *tp, tp->cur_page = value; return; } - rtl8125_mdio_real_write_phy_ocp(tp, tp->cur_page, RegAddr, value); + rtl8126_mdio_real_write_phy_ocp(tp, tp->cur_page, RegAddr, value); } -void rtl8125_mdio_write(struct rtl8125_private *tp, +void rtl8126_mdio_write(struct rtl8126_private *tp, u16 RegAddr, u16 value) { - if (tp->rtk_enable_diag) return; + if (tp->rtk_enable_diag) + return; mdio_real_write(tp, RegAddr, value); } -void rtl8125_mdio_prot_write(struct rtl8125_private *tp, +void rtl8126_mdio_prot_write(struct rtl8126_private *tp, u32 RegAddr, u32 value) { mdio_real_write(tp, RegAddr, value); } -void rtl8125_mdio_prot_direct_write_phy_ocp(struct rtl8125_private *tp, +void rtl8126_mdio_prot_direct_write_phy_ocp(struct rtl8126_private *tp, u32 RegAddr, u32 value) { mdio_real_direct_write_phy_ocp(tp, RegAddr, value); } -static u32 mdio_real_direct_read_phy_ocp(struct rtl8125_private *tp, +static u32 mdio_real_direct_read_phy_ocp(struct rtl8126_private *tp, u16 RegAddr) { u32 data32; @@ -3080,8 +3176,8 @@ static u32 mdio_real_direct_read_phy_ocp(struct rtl8125_private *tp, data32 <<= OCPR_Addr_Reg_shift; RTL_W32(tp, PHYOCP, data32); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); if (RTL_R32(tp, PHYOCP) & OCPR_Flag) break; @@ -3091,16 +3187,17 @@ static u32 mdio_real_direct_read_phy_ocp(struct rtl8125_private *tp, return value; } -static u32 mdio_direct_read_phy_ocp(struct rtl8125_private *tp, - u16 RegAddr) +static u32 rtl8126_mdio_direct_read_phy_ocp(struct rtl8126_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); } /* -static u32 rtl8125_mdio_read_phy_ocp(struct rtl8125_private *tp, +static u32 rtl8126_mdio_read_phy_ocp(struct rtl8126_private *tp, u16 PageNum, u32 RegAddr) { @@ -3108,11 +3205,11 @@ static u32 rtl8125_mdio_read_phy_ocp(struct rtl8125_private *tp, ocp_addr = map_phy_ocp_addr(PageNum, RegAddr); - return mdio_direct_read_phy_ocp(tp, ocp_addr); + return rtl8126_mdio_direct_read_phy_ocp(tp, ocp_addr); } */ -static u32 rtl8125_mdio_real_read_phy_ocp(struct rtl8125_private *tp, +static u32 rtl8126_mdio_real_read_phy_ocp(struct rtl8126_private *tp, u16 PageNum, u32 RegAddr) { @@ -3123,85 +3220,86 @@ static u32 rtl8125_mdio_real_read_phy_ocp(struct rtl8125_private *tp, return mdio_real_direct_read_phy_ocp(tp, ocp_addr); } -static u32 mdio_real_read(struct rtl8125_private *tp, +static u32 mdio_real_read(struct rtl8126_private *tp, u16 RegAddr) { - return rtl8125_mdio_real_read_phy_ocp(tp, tp->cur_page, RegAddr); + return rtl8126_mdio_real_read_phy_ocp(tp, tp->cur_page, RegAddr); } -u32 rtl8125_mdio_read(struct rtl8125_private *tp, +u32 rtl8126_mdio_read(struct rtl8126_private *tp, u16 RegAddr) { - if (tp->rtk_enable_diag) return 0xffffffff; + if (tp->rtk_enable_diag) + return 0xffffffff; return mdio_real_read(tp, RegAddr); } -u32 rtl8125_mdio_prot_read(struct rtl8125_private *tp, +u32 rtl8126_mdio_prot_read(struct rtl8126_private *tp, u32 RegAddr) { return mdio_real_read(tp, RegAddr); } -u32 rtl8125_mdio_prot_direct_read_phy_ocp(struct rtl8125_private *tp, +u32 rtl8126_mdio_prot_direct_read_phy_ocp(struct rtl8126_private *tp, u32 RegAddr) { 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 rtl8126_clear_and_set_eth_phy_bit(struct rtl8126_private *tp, u8 addr, u16 clearmask, u16 setmask) { u16 PhyRegValue; - PhyRegValue = rtl8125_mdio_read(tp, addr); + PhyRegValue = rtl8126_mdio_read(tp, addr); PhyRegValue &= ~clearmask; PhyRegValue |= setmask; - rtl8125_mdio_write(tp, addr, PhyRegValue); + rtl8126_mdio_write(tp, addr, PhyRegValue); } -void rtl8125_clear_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask) +void rtl8126_clear_eth_phy_bit(struct rtl8126_private *tp, u8 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_bit(tp, + rtl8126_clear_and_set_eth_phy_bit(tp, addr, mask, 0); } -void rtl8125_set_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask) +void rtl8126_set_eth_phy_bit(struct rtl8126_private *tp, u8 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_bit(tp, + rtl8126_clear_and_set_eth_phy_bit(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 rtl8126_clear_and_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 clearmask, u16 setmask) { u16 PhyRegValue; - PhyRegValue = mdio_direct_read_phy_ocp(tp, addr); + PhyRegValue = rtl8126_mdio_direct_read_phy_ocp(tp, addr); PhyRegValue &= ~clearmask; PhyRegValue |= setmask; - mdio_direct_write_phy_ocp(tp, addr, PhyRegValue); + rtl8126_mdio_direct_write_phy_ocp(tp, addr, PhyRegValue); } -static void rtl8125_clear_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 mask) +static void rtl8126_clear_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, addr, mask, 0); } -static void rtl8125_set_eth_phy_ocp_bit(struct rtl8125_private *tp, u16 addr, u16 mask) +static void rtl8126_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask) { - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, addr, 0, mask); } -void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value) +void rtl8126_mac_ocp_write(struct rtl8126_private *tp, u16 reg_addr, u16 value) { u32 data32; @@ -3217,7 +3315,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) +u16 rtl8126_mac_ocp_read(struct rtl8126_private *tp, u16 reg_addr) { u32 data32; u16 data16 = 0; @@ -3236,25 +3334,25 @@ u16 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr) } #ifdef ENABLE_USE_FIRMWARE_FILE -static void mac_mcu_write(struct rtl8125_private *tp, u16 reg, u16 value) +static void mac_mcu_write(struct rtl8126_private *tp, u16 reg, u16 value) { if (reg == 0x1f) { tp->ocp_base = value << 4; return; } - rtl8125_mac_ocp_write(tp, tp->ocp_base + reg, value); + rtl8126_mac_ocp_write(tp, tp->ocp_base + reg, value); } -static u32 mac_mcu_read(struct rtl8125_private *tp, u16 reg) +static u32 mac_mcu_read(struct rtl8126_private *tp, u16 reg) { - return rtl8125_mac_ocp_read(tp, tp->ocp_base + reg); + return rtl8126_mac_ocp_read(tp, tp->ocp_base + reg); } #endif static void -rtl8125_clear_set_mac_ocp_bit( - struct rtl8125_private *tp, +rtl8126_clear_set_mac_ocp_bit( + struct rtl8126_private *tp, u16 addr, u16 clearmask, u16 setmask @@ -3262,71 +3360,75 @@ rtl8125_clear_set_mac_ocp_bit( { u16 PhyRegValue; - PhyRegValue = rtl8125_mac_ocp_read(tp, addr); + PhyRegValue = rtl8126_mac_ocp_read(tp, addr); PhyRegValue &= ~clearmask; PhyRegValue |= setmask; - rtl8125_mac_ocp_write(tp, addr, PhyRegValue); + rtl8126_mac_ocp_write(tp, addr, PhyRegValue); } static void -rtl8125_clear_mac_ocp_bit( - struct rtl8125_private *tp, +rtl8126_clear_mac_ocp_bit( + struct rtl8126_private *tp, u16 addr, u16 mask ) { - rtl8125_clear_set_mac_ocp_bit(tp, + rtl8126_clear_set_mac_ocp_bit(tp, addr, mask, - 0 - ); + 0); } static void -rtl8125_set_mac_ocp_bit( - struct rtl8125_private *tp, +rtl8126_set_mac_ocp_bit( + struct rtl8126_private *tp, u16 addr, u16 mask ) { - rtl8125_clear_set_mac_ocp_bit(tp, + rtl8126_clear_set_mac_ocp_bit(tp, addr, 0, - mask - ); + mask); } -u32 rtl8125_ocp_read_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, const u32 base_address) +u32 rtl8126_ocp_read_with_oob_base_address(struct rtl8126_private *tp, u16 addr, u8 len, const u32 base_address) { - return rtl8125_eri_read_with_oob_base_address(tp, addr, len, ERIAR_OOB, base_address); + return rtl8126_eri_read_with_oob_base_address(tp, addr, len, ERIAR_OOB, base_address); } -u32 rtl8125_ocp_read(struct rtl8125_private *tp, u16 addr, u8 len) +u32 rtl8126_ocp_read(struct rtl8126_private *tp, u16 addr, u8 len) { u32 value = 0; + if (!tp->AllowAccessDashOcp) + return 0xffffffff; + if (HW_DASH_SUPPORT_TYPE_2(tp)) - value = rtl8125_ocp_read_with_oob_base_address(tp, addr, len, NO_BASE_ADDRESS); + value = rtl8126_ocp_read_with_oob_base_address(tp, addr, len, NO_BASE_ADDRESS); else if (HW_DASH_SUPPORT_TYPE_3(tp)) - value = rtl8125_ocp_read_with_oob_base_address(tp, addr, len, RTL8168FP_OOBMAC_BASE); + value = rtl8126_ocp_read_with_oob_base_address(tp, addr, len, RTL8168FP_OOBMAC_BASE); return value; } -u32 rtl8125_ocp_write_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 value, const u32 base_address) +u32 rtl8126_ocp_write_with_oob_base_address(struct rtl8126_private *tp, u16 addr, u8 len, u32 value, const u32 base_address) { - return rtl8125_eri_write_with_oob_base_address(tp, addr, len, value, ERIAR_OOB, base_address); + return rtl8126_eri_write_with_oob_base_address(tp, addr, len, value, ERIAR_OOB, base_address); } -void rtl8125_ocp_write(struct rtl8125_private *tp, u16 addr, u8 len, u32 value) +void rtl8126_ocp_write(struct rtl8126_private *tp, u16 addr, u8 len, u32 value) { + if (!tp->AllowAccessDashOcp) + return; + if (HW_DASH_SUPPORT_TYPE_2(tp)) - rtl8125_ocp_write_with_oob_base_address(tp, addr, len, value, NO_BASE_ADDRESS); + rtl8126_ocp_write_with_oob_base_address(tp, addr, len, value, NO_BASE_ADDRESS); else if (HW_DASH_SUPPORT_TYPE_3(tp)) - rtl8125_ocp_write_with_oob_base_address(tp, addr, len, value, RTL8168FP_OOBMAC_BASE); + rtl8126_ocp_write_with_oob_base_address(tp, addr, len, value, RTL8168FP_OOBMAC_BASE); } -void rtl8125_oob_mutex_lock(struct rtl8125_private *tp) +void rtl8126_oob_mutex_lock(struct rtl8126_private *tp) { u8 reg_16, reg_a0; u32 wait_cnt_0, wait_Cnt_1; @@ -3334,41 +3436,35 @@ 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_6: - 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); - reg_16 = rtl8125_ocp_read(tp, ocp_reg_mutex_oob, 1); + rtl8126_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0); + reg_16 = rtl8126_ocp_read(tp, ocp_reg_mutex_oob, 1); wait_cnt_0 = 0; while(reg_16) { - reg_a0 = rtl8125_ocp_read(tp, ocp_reg_mutex_prio, 1); + reg_a0 = rtl8126_ocp_read(tp, ocp_reg_mutex_prio, 1); if (reg_a0) { - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00); - reg_a0 = rtl8125_ocp_read(tp, ocp_reg_mutex_prio, 1); + rtl8126_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00); + reg_a0 = rtl8126_ocp_read(tp, ocp_reg_mutex_prio, 1); wait_Cnt_1 = 0; while(reg_a0) { - reg_a0 = rtl8125_ocp_read(tp, ocp_reg_mutex_prio, 1); + reg_a0 = rtl8126_ocp_read(tp, ocp_reg_mutex_prio, 1); wait_Cnt_1++; if (wait_Cnt_1 > 2000) break; }; - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0); + rtl8126_ocp_write(tp, ocp_reg_mutex_ib, 1, BIT_0); } - reg_16 = rtl8125_ocp_read(tp, ocp_reg_mutex_oob, 1); + reg_16 = rtl8126_ocp_read(tp, ocp_reg_mutex_oob, 1); wait_cnt_0++; @@ -3377,68 +3473,76 @@ void rtl8125_oob_mutex_lock(struct rtl8125_private *tp) }; } -void rtl8125_oob_mutex_unlock(struct rtl8125_private *tp) +void rtl8126_oob_mutex_unlock(struct rtl8126_private *tp) { - u16 ocp_reg_mutex_ib; - u16 ocp_reg_mutex_oob; - u16 ocp_reg_mutex_prio; + //u16 ocp_reg_mutex_ib; + //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_6: - 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); - rtl8125_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00); + //rtl8126_ocp_write(tp, ocp_reg_mutex_prio, 1, BIT_0); + //rtl8126_ocp_write(tp, ocp_reg_mutex_ib, 1, 0x00); } -void rtl8125_oob_notify(struct rtl8125_private *tp, u8 cmd) +static bool +rtl8126_is_allow_access_dash_ocp(struct rtl8126_private *tp) { - rtl8125_eri_write(tp, 0xE8, 1, cmd, ERIAR_ExGMAC); + bool allow_access = false; - rtl8125_ocp_write(tp, 0x30, 1, 0x01); + if (!HW_DASH_SUPPORT_DASH(tp)) + goto exit; + + allow_access = true; + switch (tp->mcfg) { + default: + goto exit; + } +exit: + return allow_access; } -static int rtl8125_check_dash(struct rtl8125_private *tp) +static int rtl8126_check_dash(struct rtl8126_private *tp) { + if (!tp->AllowAccessDashOcp) + return 0; + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - if (rtl8125_ocp_read(tp, 0x128, 1) & BIT_0) + if (rtl8126_ocp_read(tp, 0x128, 1) & BIT_0) return 1; } return 0; } -void rtl8125_dash2_disable_tx(struct rtl8125_private *tp) +void rtl8126_dash2_disable_tx(struct rtl8126_private *tp) { - if (!tp->DASH) return; + if (!tp->DASH) + return; if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { u16 WaitCnt; u8 TmpUchar; //Disable oob Tx - RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) & ~( BIT_0 )); + 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 ) { + if (TmpUchar & ISRIMR_DASH_TYPE2_TX_DISABLE_IDLE) { break; } - udelay( 50 ); + udelay(50); WaitCnt++; } while(WaitCnt < 2000); @@ -3447,44 +3551,47 @@ void rtl8125_dash2_disable_tx(struct rtl8125_private *tp) } } -void rtl8125_dash2_enable_tx(struct rtl8125_private *tp) +void rtl8126_dash2_enable_tx(struct rtl8126_private *tp) { - if (!tp->DASH) return; + if (!tp->DASH) + return; if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { RTL_CMAC_W8(tp, CMAC_IBCR2, RTL_CMAC_R8(tp, CMAC_IBCR2) | BIT_0); } } -void rtl8125_dash2_disable_rx(struct rtl8125_private *tp) +void rtl8126_dash2_disable_rx(struct rtl8126_private *tp) { - if (!tp->DASH) return; + if (!tp->DASH) + return; if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~( BIT_0 )); + RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~(BIT_0)); } } -void rtl8125_dash2_enable_rx(struct rtl8125_private *tp) +void rtl8126_dash2_enable_rx(struct rtl8126_private *tp) { - if (!tp->DASH) return; + if (!tp->DASH) + return; if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) | BIT_0); } } -static void rtl8125_dash2_disable_txrx(struct net_device *dev) +static void rtl8126_dash2_disable_txrx(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - rtl8125_dash2_disable_tx( tp ); - rtl8125_dash2_disable_rx( tp ); + rtl8126_dash2_disable_tx(tp); + rtl8126_dash2_disable_rx(tp); } } -static int rtl8125_wait_dash_fw_ready(struct rtl8125_private *tp) +static int rtl8126_wait_dash_fw_ready(struct rtl8126_private *tp) { int rc = -1; int timeout; @@ -3498,7 +3605,7 @@ static int rtl8125_wait_dash_fw_ready(struct rtl8125_private *tp) for (timeout = 0; timeout < 10; timeout++) { mdelay(10); - if (rtl8125_ocp_read(tp, 0x124, 1) & BIT_0) { + if (rtl8126_ocp_read(tp, 0x124, 1) & BIT_0) { rc = 1; goto out; } @@ -3510,7 +3617,7 @@ out: return rc; } -static void rtl8125_driver_start(struct rtl8125_private *tp) +static void rtl8126_driver_start(struct rtl8126_private *tp) { u32 tmp_value; @@ -3518,15 +3625,18 @@ static void rtl8125_driver_start(struct rtl8125_private *tp) HW_DASH_SUPPORT_TYPE_3(tp) == FALSE) return; - 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); + if (!tp->AllowAccessDashOcp) + return; - rtl8125_wait_dash_fw_ready(tp); + rtl8126_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_START); + tmp_value = rtl8126_ocp_read(tp, 0x30, 1); + tmp_value |= BIT_0; + rtl8126_ocp_write(tp, 0x30, 1, tmp_value); + + rtl8126_wait_dash_fw_ready(tp); } -static void rtl8125_driver_stop(struct rtl8125_private *tp) +static void rtl8126_driver_stop(struct rtl8126_private *tp) { u32 tmp_value; struct net_device *dev = tp->dev; @@ -3535,17 +3645,20 @@ static void rtl8125_driver_stop(struct rtl8125_private *tp) HW_DASH_SUPPORT_TYPE_3(tp) == FALSE) return; - rtl8125_dash2_disable_txrx(dev); + if (!tp->AllowAccessDashOcp) + return; - rtl8125_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_STOP); - tmp_value = rtl8125_ocp_read(tp, 0x30, 1); + rtl8126_dash2_disable_txrx(dev); + + rtl8126_ocp_write(tp, 0x180, 1, OOB_CMD_DRIVER_STOP); + tmp_value = rtl8126_ocp_read(tp, 0x30, 1); tmp_value |= BIT_0; - rtl8125_ocp_write(tp, 0x30, 1, tmp_value); + rtl8126_ocp_write(tp, 0x30, 1, tmp_value); - rtl8125_wait_dash_fw_ready(tp); + rtl8126_wait_dash_fw_ready(tp); } -void rtl8125_ephy_write(struct rtl8125_private *tp, int RegAddr, int value) +void rtl8126_ephy_write(struct rtl8126_private *tp, int RegAddr, int value) { int i; @@ -3554,18 +3667,18 @@ void rtl8125_ephy_write(struct rtl8125_private *tp, int RegAddr, int value) (RegAddr & EPHYAR_Reg_Mask_v2) << EPHYAR_Reg_shift | (value & EPHYAR_Data_Mask)); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); /* Check if the RTL8125 has completed EPHY write */ if (!(RTL_R32(tp, EPHYAR) & EPHYAR_Flag)) break; } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); } -u16 rtl8125_ephy_read(struct rtl8125_private *tp, int RegAddr) +u16 rtl8126_ephy_read(struct rtl8126_private *tp, int RegAddr) { int i; u16 value = 0xffff; @@ -3573,8 +3686,8 @@ u16 rtl8125_ephy_read(struct rtl8125_private *tp, int RegAddr) RTL_W32(tp, EPHYAR, EPHYAR_Read | (RegAddr & EPHYAR_Reg_Mask_v2) << EPHYAR_Reg_shift); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); /* Check if the RTL8125 has completed EPHY read */ if (RTL_R32(tp, EPHYAR) & EPHYAR_Flag) { @@ -3583,41 +3696,41 @@ u16 rtl8125_ephy_read(struct rtl8125_private *tp, int RegAddr) } } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); return value; } -static void ClearAndSetPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 clearmask, u16 setmask) +/* +static void ClearAndSetPCIePhyBit(struct rtl8126_private *tp, u8 addr, u16 clearmask, u16 setmask) { u16 EphyValue; - EphyValue = rtl8125_ephy_read(tp, addr); + EphyValue = rtl8126_ephy_read(tp, addr); EphyValue &= ~clearmask; EphyValue |= setmask; - rtl8125_ephy_write(tp, addr, EphyValue); + rtl8126_ephy_write(tp, addr, EphyValue); } -static void ClearPCIePhyBit(struct rtl8125_private *tp, u8 addr, u16 mask) +static void ClearPCIePhyBit(struct rtl8126_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 rtl8126_private *tp, u8 addr, u16 mask) { - ClearAndSetPCIePhyBit( tp, - addr, - 0, - mask - ); + ClearAndSetPCIePhyBit(tp, + addr, + 0, + mask); } +*/ static u32 -rtl8125_csi_other_fun_read(struct rtl8125_private *tp, +rtl8126_csi_other_fun_read(struct rtl8126_private *tp, u8 multi_fun_sel_bit, u32 addr) { @@ -3637,8 +3750,8 @@ rtl8125_csi_other_fun_read(struct rtl8125_private *tp, RTL_W32(tp, CSIAR, cmd); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); /* Check if the RTL8125 has completed CSI read */ if (RTL_R32(tp, CSIAR) & CSIAR_Flag) { @@ -3647,14 +3760,14 @@ rtl8125_csi_other_fun_read(struct rtl8125_private *tp, } } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); exit: return value; } static void -rtl8125_csi_other_fun_write(struct rtl8125_private *tp, +rtl8126_csi_other_fun_write(struct rtl8126_private *tp, u8 multi_fun_sel_bit, u32 addr, u32 value) @@ -3667,37 +3780,37 @@ 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; RTL_W32(tp, CSIAR, cmd); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); /* Check if the RTL8125 has completed CSI write */ if (!(RTL_R32(tp, CSIAR) & CSIAR_Flag)) break; } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); } static u32 -rtl8125_csi_read(struct rtl8125_private *tp, +rtl8126_csi_read(struct rtl8126_private *tp, u32 addr) { u8 multi_fun_sel_bit; multi_fun_sel_bit = 0; - return rtl8125_csi_other_fun_read(tp, multi_fun_sel_bit, addr); + return rtl8126_csi_other_fun_read(tp, multi_fun_sel_bit, addr); } static void -rtl8125_csi_write(struct rtl8125_private *tp, +rtl8126_csi_write(struct rtl8126_private *tp, u32 addr, u32 value) { @@ -3705,11 +3818,11 @@ rtl8125_csi_write(struct rtl8125_private *tp, multi_fun_sel_bit = 0; - rtl8125_csi_other_fun_write(tp, multi_fun_sel_bit, addr, value); + rtl8126_csi_other_fun_write(tp, multi_fun_sel_bit, addr, value); } static u8 -rtl8125_csi_fun0_read_byte(struct rtl8125_private *tp, +rtl8126_csi_fun0_read_byte(struct rtl8126_private *tp, u32 addr) { u8 RetVal = 0; @@ -3725,18 +3838,18 @@ rtl8125_csi_fun0_read_byte(struct rtl8125_private *tp, RegAlignAddr = addr & ~(0x3); ShiftByte = addr & (0x3); - TmpUlong = rtl8125_csi_other_fun_read(tp, 0, RegAlignAddr); + TmpUlong = rtl8126_csi_other_fun_read(tp, 0, RegAlignAddr); TmpUlong >>= (8*ShiftByte); RetVal = (u8)TmpUlong; } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); return RetVal; } static void -rtl8125_csi_fun0_write_byte(struct rtl8125_private *tp, +rtl8126_csi_fun0_write_byte(struct rtl8126_private *tp, u32 addr, u8 value) { @@ -3751,16 +3864,16 @@ rtl8125_csi_fun0_write_byte(struct rtl8125_private *tp, RegAlignAddr = addr & ~(0x3); ShiftByte = addr & (0x3); - TmpUlong = rtl8125_csi_other_fun_read(tp, 0, RegAlignAddr); + TmpUlong = rtl8126_csi_other_fun_read(tp, 0, RegAlignAddr); TmpUlong &= ~(0xFF << (8*ShiftByte)); TmpUlong |= (value << (8*ShiftByte)); - rtl8125_csi_other_fun_write( tp, 0, RegAlignAddr, TmpUlong ); + rtl8126_csi_other_fun_write(tp, 0, RegAlignAddr, TmpUlong); } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); } -u32 rtl8125_eri_read_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, int type, const u32 base_address) +u32 rtl8126_eri_read_with_oob_base_address(struct rtl8126_private *tp, int addr, int len, int type, const u32 base_address) { int i, val_shift, shift = 0; u32 value1 = 0, value2 = 0, mask; @@ -3789,8 +3902,8 @@ u32 rtl8125_eri_read_with_oob_base_address(struct rtl8125_private *tp, int addr, RTL_W32(tp, ERIAR, eri_cmd); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); /* Check if the RTL8125 has completed ERI read */ if (RTL_R32(tp, ERIAR) & ERIAR_Flag) @@ -3814,17 +3927,17 @@ u32 rtl8125_eri_read_with_oob_base_address(struct rtl8125_private *tp, int addr, } } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); return value2; } -u32 rtl8125_eri_read(struct rtl8125_private *tp, int addr, int len, int type) +u32 rtl8126_eri_read(struct rtl8126_private *tp, int addr, int len, int type) { - return rtl8125_eri_read_with_oob_base_address(tp, addr, len, type, 0); + return rtl8126_eri_read_with_oob_base_address(tp, addr, len, type, 0); } -int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr, int len, u32 value, int type, const u32 base_address) +int rtl8126_eri_write_with_oob_base_address(struct rtl8126_private *tp, int addr, int len, u32 value, int type, const u32 base_address) { int i, val_shift, shift = 0; u32 value1 = 0, mask; @@ -3843,7 +3956,7 @@ int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr else if (len == 3) mask = (0xFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; else mask = (0xFFFFFFFF << (val_shift * 8)) & 0xFFFFFFFF; - value1 = rtl8125_eri_read_with_oob_base_address(tp, addr, 4, type, base_address) & ~mask; + value1 = rtl8126_eri_read_with_oob_base_address(tp, addr, 4, type, base_address) & ~mask; value1 |= ((value << val_shift * 8) >> shift * 8); RTL_W32(tp, ERIDR, value1); @@ -3863,8 +3976,8 @@ int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr RTL_W32(tp, ERIAR, eri_cmd); - for (i = 0; i < R8125_CHANNEL_WAIT_COUNT; i++) { - udelay(R8125_CHANNEL_WAIT_TIME); + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + udelay(R8126_CHANNEL_WAIT_TIME); /* Check if the RTL8125 has completed ERI write */ if (!(RTL_R32(tp, ERIAR) & ERIAR_Flag)) @@ -3880,31 +3993,25 @@ int rtl8125_eri_write_with_oob_base_address(struct rtl8125_private *tp, int addr } } - udelay(R8125_CHANNEL_EXIT_DELAY_TIME); + udelay(R8126_CHANNEL_EXIT_DELAY_TIME); return 0; } -int rtl8125_eri_write(struct rtl8125_private *tp, int addr, int len, u32 value, int type) +int rtl8126_eri_write(struct rtl8126_private *tp, int addr, int len, u32 value, int type) { - return rtl8125_eri_write_with_oob_base_address(tp, addr, len, value, type, NO_BASE_ADDRESS); + return rtl8126_eri_write_with_oob_base_address(tp, addr, len, value, type, NO_BASE_ADDRESS); } static void -rtl8125_enable_rxdvgate(struct net_device *dev) +rtl8126_enable_rxdvgate(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) | BIT_3); mdelay(2); break; @@ -3912,20 +4019,14 @@ rtl8125_enable_rxdvgate(struct net_device *dev) } static void -rtl8125_disable_rxdvgate(struct net_device *dev) +rtl8126_disable_rxdvgate(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_3); mdelay(2); break; @@ -3933,14 +4034,14 @@ rtl8125_disable_rxdvgate(struct net_device *dev) } static u8 -rtl8125_is_gpio_low(struct net_device *dev) +rtl8126_is_gpio_low(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u8 gpio_low = FALSE; switch (tp->HwSuppCheckPhyDisableModeVer) { case 3: - if (!(rtl8125_mac_ocp_read(tp, 0xDC04) & BIT_13)) + if (!(rtl8126_mac_ocp_read(tp, 0xDC04) & BIT_13)) gpio_low = TRUE; break; } @@ -3952,9 +4053,9 @@ rtl8125_is_gpio_low(struct net_device *dev) } static u8 -rtl8125_is_phy_disable_mode_enabled(struct net_device *dev) +rtl8126_is_phy_disable_mode_enabled(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u8 phy_disable_mode_enabled = FALSE; switch (tp->HwSuppCheckPhyDisableModeVer) { @@ -3971,11 +4072,11 @@ rtl8125_is_phy_disable_mode_enabled(struct net_device *dev) } static u8 -rtl8125_is_in_phy_disable_mode(struct net_device *dev) +rtl8126_is_in_phy_disable_mode(struct net_device *dev) { u8 in_phy_disable_mode = FALSE; - if (rtl8125_is_phy_disable_mode_enabled(dev) && rtl8125_is_gpio_low(dev)) + if (rtl8126_is_phy_disable_mode_enabled(dev) && rtl8126_is_gpio_low(dev)) in_phy_disable_mode = TRUE; if (in_phy_disable_mode) @@ -3985,57 +4086,33 @@ rtl8125_is_in_phy_disable_mode(struct net_device *dev) } static bool -rtl8125_stop_all_request(struct net_device *dev) +rtl8126_stop_all_request(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); - int i; + struct rtl8126_private *tp = netdev_priv(dev); RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - for (i = 0; i < 20; i++) { - udelay(10); - if (!(RTL_R8(tp, ChipCmd) & StopReq)) break; - } - - if (i == 20) - return 0; - break; - } - return 1; } void -rtl8125_wait_txrx_fifo_empty(struct net_device *dev) +rtl8126_wait_txrx_fifo_empty(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; 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: - rtl8125_stop_all_request(dev); + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + rtl8126_stop_all_request(dev); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: for (i = 0; i < 3000; i++) { udelay(50); if ((RTL_R8(tp, MCUCmd_reg) & (Txfifo_empty | Rxfifo_empty)) == (Txfifo_empty | Rxfifo_empty)) @@ -4045,12 +4122,9 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) } 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_1: + case CFG_METHOD_2: + case CFG_METHOD_3: 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)) @@ -4063,19 +4137,21 @@ rtl8125_wait_txrx_fifo_empty(struct net_device *dev) #ifdef ENABLE_DASH_SUPPORT static inline void -rtl8125_enable_dash2_interrupt(struct rtl8125_private *tp) +rtl8126_enable_dash2_interrupt(struct rtl8126_private *tp) { - if (!tp->DASH) return; + if (!tp->DASH) + return; if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - RTL_CMAC_W8(tp, CMAC_IBIMR0, ( ISRIMR_DASH_TYPE2_ROK | ISRIMR_DASH_TYPE2_TOK | ISRIMR_DASH_TYPE2_TDU | ISRIMR_DASH_TYPE2_RDU | ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE )); + 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) +rtl8126_disable_dash2_interrupt(struct rtl8126_private *tp) { - if (!tp->DASH) return; + if (!tp->DASH) + return; if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { RTL_CMAC_W8(tp, CMAC_IBIMR0, 0); @@ -4084,9 +4160,15 @@ rtl8125_disable_dash2_interrupt(struct rtl8125_private *tp) #endif void -rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp) +rtl8126_enable_hw_linkchg_interrupt(struct rtl8126_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); @@ -4098,22 +4180,24 @@ rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp) #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) - rtl8125_enable_dash2_interrupt(tp); + rtl8126_enable_dash2_interrupt(tp); #endif } static inline void -rtl8125_enable_hw_interrupt(struct rtl8125_private *tp) +rtl8126_enable_hw_interrupt(struct rtl8126_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: RTL_W32(tp, tp->imr_reg[0], tp->intr_mask); - if (R8125_MULTI_RX_Q(tp)) { + if (R8126_MULTI_RX_Q(tp)) { int i; for (i=1; inum_rx_rings; i++) RTL_W16(tp, tp->imr_reg[i], other_q_intr_mask); @@ -4123,25 +4207,27 @@ rtl8125_enable_hw_interrupt(struct rtl8125_private *tp) #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) - rtl8125_enable_dash2_interrupt(tp); + rtl8126_enable_dash2_interrupt(tp); #endif } -static inline void rtl8125_clear_hw_isr_v2(struct rtl8125_private *tp, +static inline void rtl8126_clear_hw_isr_v2(struct rtl8126_private *tp, u32 message_id) { RTL_W32(tp, ISR_V2_8125, BIT(message_id)); } static inline void -rtl8125_disable_hw_interrupt(struct rtl8125_private *tp) +rtl8126_disable_hw_interrupt(struct rtl8126_private *tp) { if (tp->HwCurrIsrVer > 1) { 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); - if (R8125_MULTI_RX_Q(tp)) { + if (R8126_MULTI_RX_Q(tp)) { int i; for (i=1; inum_rx_rings; i++) RTL_W16(tp, tp->imr_reg[i], 0); @@ -4149,21 +4235,21 @@ rtl8125_disable_hw_interrupt(struct rtl8125_private *tp) #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) - rtl8125_disable_dash2_interrupt(tp); + rtl8126_disable_dash2_interrupt(tp); #endif } } static inline void -rtl8125_switch_to_hw_interrupt(struct rtl8125_private *tp) +rtl8126_switch_to_hw_interrupt(struct rtl8126_private *tp) { RTL_W32(tp, TIMER_INT0_8125, 0x0000); - rtl8125_enable_hw_interrupt(tp); + rtl8126_enable_hw_interrupt(tp); } static inline void -rtl8125_switch_to_timer_interrupt(struct rtl8125_private *tp) +rtl8126_switch_to_timer_interrupt(struct rtl8126_private *tp) { if (tp->use_timer_interrupt) { RTL_W32(tp, TIMER_INT0_8125, timer_count); @@ -4172,20 +4258,22 @@ rtl8125_switch_to_timer_interrupt(struct rtl8125_private *tp) #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) - rtl8125_enable_dash2_interrupt(tp); + rtl8126_enable_dash2_interrupt(tp); #endif } else { - rtl8125_switch_to_hw_interrupt(tp); + rtl8126_switch_to_hw_interrupt(tp); } } static void -rtl8125_irq_mask_and_ack(struct rtl8125_private *tp) +rtl8126_irq_mask_and_ack(struct rtl8126_private *tp) { - rtl8125_disable_hw_interrupt(tp); + rtl8126_disable_hw_interrupt(tp); if (tp->HwCurrIsrVer > 1) { 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) { @@ -4203,7 +4291,7 @@ rtl8125_irq_mask_and_ack(struct rtl8125_private *tp) #else RTL_W32(tp, tp->isr_reg[0], RTL_R32(tp, tp->isr_reg[0])); #endif - if (R8125_MULTI_RX_Q(tp)) { + if (R8126_MULTI_RX_Q(tp)) { int i; for (i=1; inum_rx_rings; i++) RTL_W16(tp, tp->isr_reg[i], RTL_R16(tp, tp->isr_reg[i])); @@ -4212,7 +4300,7 @@ rtl8125_irq_mask_and_ack(struct rtl8125_private *tp) } static void -rtl8125_disable_rx_packet_filter(struct rtl8125_private *tp) +rtl8126_disable_rx_packet_filter(struct rtl8126_private *tp) { RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & @@ -4221,18 +4309,18 @@ rtl8125_disable_rx_packet_filter(struct rtl8125_private *tp) } static void -rtl8125_nic_reset(struct net_device *dev) +rtl8126_nic_reset(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; - rtl8125_disable_rx_packet_filter(tp); + rtl8126_disable_rx_packet_filter(tp); - rtl8125_enable_rxdvgate(dev); + rtl8126_enable_rxdvgate(dev); - rtl8125_stop_all_request(dev); + rtl8126_stop_all_request(dev); - rtl8125_wait_txrx_fifo_empty(dev); + rtl8126_wait_txrx_fifo_empty(dev); mdelay(2); @@ -4245,40 +4333,48 @@ 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 -rtl8125_hw_set_interrupt_type(struct rtl8125_private *tp, u8 isr_ver) +rtl8126_hw_set_interrupt_type(struct rtl8126_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) tmp |= INT_CFG0_ENABLE_8125; - RTL_W8(tp, INT_CFG0_8125, tmp); break; + default: + return; } + + RTL_W8(tp, INT_CFG0_8125, tmp); } static void -rtl8125_hw_clear_timer_int(struct net_device *dev) +rtl8126_hw_clear_timer_int(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W32(tp, TIMER_INT0_8125, 0x0000); RTL_W32(tp, TIMER_INT1_8125, 0x0000); RTL_W32(tp, TIMER_INT2_8125, 0x0000); @@ -4288,13 +4384,14 @@ rtl8125_hw_clear_timer_int(struct net_device *dev) } static void -rtl8125_hw_clear_int_miti(struct net_device *dev) +rtl8126_hw_clear_int_miti(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; switch (tp->HwSuppIntMitiVer) { case 3: + case 6: //IntMITI_0-IntMITI_31 for (i=0xA00; i<0xB00; i+=4) RTL_W32(tp, i, 0x0000); @@ -4320,28 +4417,29 @@ rtl8125_hw_clear_int_miti(struct net_device *dev) } void -rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, +rtl8126_hw_set_timer_int_8125(struct rtl8126_private *tp, u32 message_id, u8 timer_intmiti_val) { switch (tp->HwSuppIntMitiVer) { case 4: #ifdef ENABLE_LIB_SUPPORT - if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) + if (message_id < R8126_MAX_RX_QUEUES_VEC_V3) timer_intmiti_val = 0; #else - if ((tp->HwCurrIsrVer == 2) && (message_id < R8125_MAX_RX_QUEUES_VEC_V3)) + if ((tp->HwCurrIsrVer == 2) && (message_id < R8126_MAX_RX_QUEUES_VEC_V3)) timer_intmiti_val = 0; #endif //ENABLE_LIB_SUPPORT - if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) //ROK + if (message_id < R8126_MAX_RX_QUEUES_VEC_V3) //ROK RTL_W8(tp,INT_MITI_V2_0_RX + 8 * message_id, timer_intmiti_val); - else if (message_id == 16) //TOK + if (message_id == 16) //TOK RTL_W8(tp,INT_MITI_V2_0_TX, timer_intmiti_val); - else if (message_id == 18) //TOK + if (message_id == 18 && tp->num_tx_rings > 0) //TOK RTL_W8(tp,INT_MITI_V2_1_TX, timer_intmiti_val); break; case 5: - if (message_id < R8125_MAX_RX_QUEUES_VEC_V3) //ROK + case 6: + if (message_id < R8126_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 RTL_W8(tp,INT_MITI_V2_0_TX, timer_intmiti_val); @@ -4352,36 +4450,36 @@ rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, } void -rtl8125_hw_reset(struct net_device *dev) +rtl8126_hw_reset(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - rtl8125_lib_reset_prepare(tp); + rtl8126_lib_reset_prepare(tp); /* Disable interrupts */ - rtl8125_irq_mask_and_ack(tp); + rtl8126_irq_mask_and_ack(tp); - rtl8125_hw_clear_timer_int(dev); + rtl8126_hw_clear_timer_int(dev); - rtl8125_nic_reset(dev); + rtl8126_nic_reset(dev); } static unsigned int -rtl8125_xmii_reset_pending(struct net_device *dev) +rtl8126_xmii_reset_pending(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); unsigned int retval; - rtl8125_mdio_write(tp, 0x1f, 0x0000); - retval = rtl8125_mdio_read(tp, MII_BMCR) & BMCR_RESET; + rtl8126_mdio_write(tp, 0x1f, 0x0000); + retval = rtl8126_mdio_read(tp, MII_BMCR) & BMCR_RESET; return retval; } static unsigned int -rtl8125_xmii_link_ok(struct net_device *dev) +rtl8126_xmii_link_ok(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 status; status = RTL_R16(tp, PHYstatus); @@ -4392,12 +4490,12 @@ rtl8125_xmii_link_ok(struct net_device *dev) } static int -rtl8125_wait_phy_reset_complete(struct rtl8125_private *tp) +rtl8126_wait_phy_reset_complete(struct rtl8126_private *tp) { int i, val; for (i = 0; i < 2500; i++) { - val = rtl8125_mdio_read(tp, MII_BMCR) & BMCR_RESET; + val = rtl8126_mdio_read(tp, MII_BMCR) & BMCR_RESET; if (!val) return 0; @@ -4408,36 +4506,37 @@ rtl8125_wait_phy_reset_complete(struct rtl8125_private *tp) } static void -rtl8125_xmii_reset_enable(struct net_device *dev) +rtl8126_xmii_reset_enable(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (rtl8125_is_in_phy_disable_mode(dev)) { + if (rtl8126_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) & + rtl8126_mdio_write(tp, 0x1f, 0x0000); + rtl8126_mdio_write(tp, MII_ADVERTISE, rtl8126_mdio_read(tp, MII_ADVERTISE) & ~(ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL)); - rtl8125_mdio_write(tp, MII_CTRL1000, rtl8125_mdio_read(tp, MII_CTRL1000) & + rtl8126_mdio_write(tp, MII_CTRL1000, rtl8126_mdio_read(tp, MII_CTRL1000) & ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL)); - mdio_direct_write_phy_ocp(tp, 0xA5D4, mdio_direct_read_phy_ocp(tp, 0xA5D4) & ~(RTK_ADVERTISE_2500FULL)); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA5D4, rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D4) & + ~(RTK_ADVERTISE_2500FULL | RTK_ADVERTISE_5000FULL)); + rtl8126_mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); - if (rtl8125_wait_phy_reset_complete(tp) == 0) return; + if (rtl8126_wait_phy_reset_complete(tp) == 0) + return; if (netif_msg_link(tp)) printk(KERN_ERR "%s: PHY reset failed.\n", dev->name); } void -rtl8125_init_ring_indexes(struct rtl8125_private *tp) +rtl8126_init_ring_indexes(struct rtl8126_private *tp) { int i; for (i = 0; i < tp->HwSuppNumTxQueues; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; ring->dirty_tx = ring->cur_tx = 0; ring->NextHwDesCloPtr = 0; ring->BeginHwDesCloPtr = 0; @@ -4450,7 +4549,7 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) } for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; ring->dirty_rx = ring->cur_rx = 0; ring->index = i; ring->priv = tp; @@ -4459,15 +4558,15 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) #ifdef ENABLE_LIB_SUPPORT for (i = 0; i < tp->HwSuppNumTxQueues; i++) { - struct rtl8125_ring *ring = &tp->lib_tx_ring[i]; - ring->direction = RTL8125_CH_DIR_TX; + struct rtl8126_ring *ring = &tp->lib_tx_ring[i]; + ring->direction = RTL8126_CH_DIR_TX; ring->queue_num = i; ring->private = tp; } for (i = 0; i < tp->HwSuppNumRxQueues; i++) { - struct rtl8125_ring *ring = &tp->lib_rx_ring[i]; - ring->direction = RTL8125_CH_DIR_RX; + struct rtl8126_ring *ring = &tp->lib_rx_ring[i]; + ring->direction = RTL8126_CH_DIR_RX; ring->queue_num = i; ring->private = tp; } @@ -4475,82 +4574,43 @@ rtl8125_init_ring_indexes(struct rtl8125_private *tp) } static void -rtl8125_issue_offset_99_event(struct rtl8125_private *tp) +rtl8126_issue_offset_99_event(struct rtl8126_private *tp) { switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xE09A, rtl8125_mac_ocp_read(tp, 0xE09A) | BIT_0); + rtl8126_mac_ocp_write(tp, 0xE09A, rtl8126_mac_ocp_read(tp, 0xE09A) | BIT_0); break; } } #ifdef ENABLE_DASH_SUPPORT static void -NICChkTypeEnableDashInterrupt(struct rtl8125_private *tp) +NICChkTypeEnableDashInterrupt(struct rtl8126_private *tp) { if (tp->DASH) { // // even disconnected, enable 3 dash interrupt mask bits for in-band/out-band communication // if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { - rtl8125_enable_dash2_interrupt(tp); + rtl8126_enable_dash2_interrupt(tp); RTL_W16(tp, IntrMask, (ISRIMR_DASH_INTR_EN | ISRIMR_DASH_INTR_CMAC_RESET)); } } } #endif -static int rtl8125_enable_eee_plus(struct rtl8125_private *tp) +static int rtl8126_enable_eee_plus(struct rtl8126_private *tp) { int ret; ret = 0; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xE080, rtl8125_mac_ocp_read(tp, 0xE080)|BIT_1); - break; - - default: -// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEEPlus\n"); - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -static int rtl8125_disable_eee_plus(struct rtl8125_private *tp) -{ - int ret; - - ret = 0; - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - rtl8125_mac_ocp_write(tp, 0xE080, rtl8125_mac_ocp_read(tp, 0xE080)&~BIT_1); + rtl8126_mac_ocp_write(tp, 0xE080, rtl8126_mac_ocp_read(tp, 0xE080)|BIT_1); break; default: // dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEEPlus\n"); @@ -4561,18 +4621,32 @@ static int rtl8125_disable_eee_plus(struct rtl8125_private *tp) return ret; } -static void rtl8125_enable_double_vlan(struct rtl8125_private *tp) +static int rtl8126_disable_eee_plus(struct rtl8126_private *tp) { + int ret; + + ret = 0; switch (tp->mcfg) { + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + rtl8126_mac_ocp_write(tp, 0xE080, rtl8126_mac_ocp_read(tp, 0xE080)&~BIT_1); + break; + default: +// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEEPlus\n"); + ret = -EOPNOTSUPP; + break; + } + + return ret; +} + +static void rtl8126_enable_double_vlan(struct rtl8126_private *tp) +{ + switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W16(tp, DOUBLE_VLAN_CONFIG, 0xf002); break; default: @@ -4580,18 +4654,12 @@ static void rtl8125_enable_double_vlan(struct rtl8125_private *tp) } } -static void rtl8125_disable_double_vlan(struct rtl8125_private *tp) +static void rtl8126_disable_double_vlan(struct rtl8126_private *tp) { switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W16(tp, DOUBLE_VLAN_CONFIG, 0); break; default: @@ -4600,53 +4668,39 @@ static void rtl8125_disable_double_vlan(struct rtl8125_private *tp) } static void -rtl8125_link_on_patch(struct net_device *dev) +rtl8126_link_on_patch(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - rtl8125_hw_config(dev); - - if ((tp->mcfg == CFG_METHOD_2) && - netif_running(dev)) { - if (RTL_R16(tp, PHYstatus)&FullDup) - RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | (BIT_24 | BIT_25)) & ~BIT_19); - else - RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | BIT_25) & ~(BIT_19 | BIT_24)); - } + rtl8126_hw_config(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: if (RTL_R8(tp, PHYstatus) & _10bps) - rtl8125_enable_eee_plus(tp); + rtl8126_enable_eee_plus(tp); break; default: break; } - rtl8125_hw_start(dev); + rtl8126_hw_start(dev); netif_carrier_on(dev); netif_tx_wake_all_queues(dev); - tp->phy_reg_aner = rtl8125_mdio_read(tp, MII_EXPANSION); - tp->phy_reg_anlpar = rtl8125_mdio_read(tp, MII_LPA); - tp->phy_reg_gbsr = rtl8125_mdio_read(tp, MII_STAT1000); - tp->phy_reg_status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); + tp->phy_reg_aner = rtl8126_mdio_read(tp, MII_EXPANSION); + tp->phy_reg_anlpar = rtl8126_mdio_read(tp, MII_LPA); + tp->phy_reg_gbsr = rtl8126_mdio_read(tp, MII_STAT1000); + tp->phy_reg_status_2500 = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D6); } static void -rtl8125_link_down_patch(struct net_device *dev) +rtl8126_link_down_patch(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); tp->phy_reg_aner = 0; tp->phy_reg_anlpar = 0; @@ -4654,16 +4708,10 @@ rtl8125_link_down_patch(struct net_device *dev) tp->phy_reg_status_2500 = 0; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_disable_eee_plus(tp); + rtl8126_disable_eee_plus(tp); break; default: break; @@ -4673,17 +4721,17 @@ rtl8125_link_down_patch(struct net_device *dev) netif_tx_disable(dev); - rtl8125_hw_reset(dev); + rtl8126_hw_reset(dev); - rtl8125_tx_clear(tp); + rtl8126_tx_clear(tp); - rtl8125_rx_clear(tp); + rtl8126_rx_clear(tp); - rtl8125_init_ring(dev); + rtl8126_init_ring(dev); - rtl8125_enable_hw_linkchg_interrupt(tp); + rtl8126_enable_hw_linkchg_interrupt(tp); - //rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + //rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) { @@ -4693,12 +4741,12 @@ rtl8125_link_down_patch(struct net_device *dev) } static void -_rtl8125_check_link_status(struct net_device *dev) +_rtl8126_check_link_status(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (tp->link_ok(dev)) { - rtl8125_link_on_patch(dev); + rtl8126_link_on_patch(dev); if (netif_msg_ifup(tp)) printk(KERN_INFO PFX "%s: link up\n", dev->name); @@ -4706,142 +4754,105 @@ _rtl8125_check_link_status(struct net_device *dev) if (netif_msg_ifdown(tp)) printk(KERN_INFO PFX "%s: link down\n", dev->name); - rtl8125_link_down_patch(dev); + rtl8126_link_down_patch(dev); } } static void -rtl8125_check_link_status(struct net_device *dev) +rtl8126_check_link_status(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - _rtl8125_check_link_status(dev); + _rtl8126_check_link_status(dev); tp->resume_not_chg_speed = 0; } -static void -rtl8125_link_option_giga(u8 *aut, - u32 *spd, - u8 *dup, - u32 *adv) +static bool +rtl8126_is_autoneg_mode_valid(u32 autoneg) { - if ((*spd != SPEED_1000) && - (*spd != SPEED_100) && - (*spd != SPEED_10)) - *spd = SPEED_1000; - - if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) - *dup = DUPLEX_FULL; - - if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE)) - *aut = AUTONEG_ENABLE; - - *adv &= (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full); - if (*adv == 0) - *adv = (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full); -} - -static void -rtl8125_link_option(u8 *aut, - u32 *spd, - u8 *dup, - u32 *adv) -{ - if ((*spd != SPEED_5000) && (*spd != SPEED_2500) && - (*spd != SPEED_1000) && (*spd != SPEED_100) && - (*spd != SPEED_10)) - *spd = SPEED_2500; - - if ((*dup != DUPLEX_FULL) && (*dup != DUPLEX_HALF)) - *dup = DUPLEX_FULL; - - if ((*aut != AUTONEG_ENABLE) && (*aut != AUTONEG_DISABLE)) - *aut = AUTONEG_ENABLE; - - *adv &= (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_2500baseX_Full); - if (*adv == 0) - *adv = (ADVERTISED_10baseT_Half | - ADVERTISED_10baseT_Full | - ADVERTISED_100baseT_Half | - ADVERTISED_100baseT_Full | - ADVERTISED_1000baseT_Half | - ADVERTISED_1000baseT_Full | - ADVERTISED_2500baseX_Full); -} - -/* -static void -rtl8125_enable_ocp_phy_power_saving(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 val; - - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) { - val = mdio_direct_read_phy_ocp(tp, 0xC416); - if (val != 0x0050) { - rtl8125_set_phy_mcu_patch_request(tp); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0050); - rtl8125_clear_phy_mcu_patch_request(tp); - } + switch(autoneg) { + case AUTONEG_ENABLE: + case AUTONEG_DISABLE: + return true; + default: + return false; } } -*/ -static void -rtl8125_disable_ocp_phy_power_saving(struct net_device *dev) +static bool +rtl8126_is_speed_mode_valid(u32 speed) { - struct rtl8125_private *tp = netdev_priv(dev); - u16 val; + switch(speed) { + case SPEED_5000: + case SPEED_2500: + case SPEED_1000: + case SPEED_100: + case SPEED_10: + return true; + default: + return false; + } +} - 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) { - val = mdio_direct_read_phy_ocp(tp, 0xC416); - if (val != 0x0500) { - rtl8125_set_phy_mcu_patch_request(tp); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xC416, 0x0500); - rtl8125_clear_phy_mcu_patch_request(tp); - } +static bool +rtl8126_is_duplex_mode_valid(u8 duplex) +{ + switch(duplex) { + case DUPLEX_FULL: + case DUPLEX_HALF: + return true; + default: + return false; } } static void -rtl8125_wait_ll_share_fifo_ready(struct net_device *dev) +rtl8126_set_link_option(struct rtl8126_private *tp, + u8 autoneg, + u32 speed, + u8 duplex, + enum rtl8126_fc_mode fc) { - struct rtl8125_private *tp = netdev_priv(dev); + u64 adv; + + if (!rtl8126_is_speed_mode_valid(speed)) + speed = SPEED_5000; + + if (!rtl8126_is_duplex_mode_valid(duplex)) + duplex = DUPLEX_FULL; + + if (!rtl8126_is_autoneg_mode_valid(autoneg)) + autoneg = AUTONEG_ENABLE; + + speed = min(speed, tp->HwSuppMaxPhyLinkSpeed); + + adv = 0; + switch(speed) { + case SPEED_5000: + adv |= RTK_ADVERTISED_5000baseX_Full; + fallthrough; + 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; + } + + tp->autoneg = autoneg; + tp->speed = speed; + tp->duplex = duplex; + tp->advertising = adv; + tp->fcpause = fc; +} + +static void +rtl8126_wait_ll_share_fifo_ready(struct net_device *dev) +{ + struct rtl8126_private *tp = netdev_priv(dev); int i; for (i = 0; i < 10; i++) { @@ -4852,296 +4863,236 @@ rtl8125_wait_ll_share_fifo_ready(struct net_device *dev) } static void -rtl8125_disable_pci_offset_99(struct rtl8125_private *tp) +rtl8126_disable_pci_offset_99(struct rtl8126_private *tp) { switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xE032, rtl8125_mac_ocp_read(tp, 0xE032) & ~(BIT_0 | BIT_1)); + rtl8126_mac_ocp_write(tp, 0xE032, rtl8126_mac_ocp_read(tp, 0xE032) & ~(BIT_0 | BIT_1)); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_csi_fun0_write_byte(tp, 0x99, 0x00); + rtl8126_csi_fun0_write_byte(tp, 0x99, 0x00); break; } } static void -rtl8125_enable_pci_offset_99(struct rtl8125_private *tp) +rtl8126_enable_pci_offset_99(struct rtl8126_private *tp) { u32 csi_tmp; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_csi_fun0_write_byte(tp, 0x99, tp->org_pci_offset_99); + rtl8126_csi_fun0_write_byte(tp, 0x99, tp->org_pci_offset_99); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE032); csi_tmp &= ~(BIT_0 | BIT_1); if (tp->org_pci_offset_99 & (BIT_5 | BIT_6)) csi_tmp |= BIT_1; if (tp->org_pci_offset_99 & BIT_2) csi_tmp |= BIT_0; - rtl8125_mac_ocp_write(tp, 0xE032, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xE032, csi_tmp); break; } } static void -rtl8125_init_pci_offset_99(struct rtl8125_private *tp) +rtl8126_init_pci_offset_99(struct rtl8126_private *tp) { u32 csi_tmp; switch (tp->mcfg) { + case CFG_METHOD_1: + rtl8126_mac_ocp_write(tp, 0xCDD0, 0x9003); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE034); + csi_tmp |= (BIT_15 | BIT_14); + rtl8126_mac_ocp_write(tp, 0xE034, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xCDD2, 0x889C); + rtl8126_mac_ocp_write(tp, 0xCDD8, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDD4, 0x8C30); + rtl8126_mac_ocp_write(tp, 0xCDDA, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDD6, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDDC, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDE8, 0x883E); + rtl8126_mac_ocp_write(tp, 0xCDEA, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDEC, 0x889C); + rtl8126_mac_ocp_write(tp, 0xCDEE, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDF0, 0x8C09); + rtl8126_mac_ocp_write(tp, 0xCDF2, 0x9003); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE032); + csi_tmp |= (BIT_14); + rtl8126_mac_ocp_write(tp, 0xE032, csi_tmp); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE0A2); + csi_tmp |= (BIT_0); + rtl8126_mac_ocp_write(tp, 0xE0A2, csi_tmp); + break; 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: - rtl8125_mac_ocp_write(tp, 0xCDD0, 0x9003); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE034); + rtl8126_mac_ocp_write(tp, 0xCDD0, 0x9003); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE034); csi_tmp |= (BIT_15 | BIT_14); - rtl8125_mac_ocp_write(tp, 0xE034, csi_tmp); - rtl8125_mac_ocp_write(tp, 0xCDD2, 0x889C); - rtl8125_mac_ocp_write(tp, 0xCDD8, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDD4, 0x8C30); - rtl8125_mac_ocp_write(tp, 0xCDDA, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDD6, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDDC, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDE8, 0x883E); - rtl8125_mac_ocp_write(tp, 0xCDEA, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDEC, 0x889C); - rtl8125_mac_ocp_write(tp, 0xCDEE, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDF0, 0x8C09); - rtl8125_mac_ocp_write(tp, 0xCDF2, 0x9003); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); + rtl8126_mac_ocp_write(tp, 0xE034, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xCDD2, 0x8A71); + rtl8126_mac_ocp_write(tp, 0xCDD8, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDD4, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDDA, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDD6, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDDC, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDE8, 0x88FA); + rtl8126_mac_ocp_write(tp, 0xCDEA, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDEC, 0x89F4); + rtl8126_mac_ocp_write(tp, 0xCDEE, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDF0, 0x8C27); + rtl8126_mac_ocp_write(tp, 0xCDF2, 0x9003); + rtl8126_mac_ocp_write(tp, 0xCDF4, 0x887D); + rtl8126_mac_ocp_write(tp, 0xCDF6, 0x9003); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE032); csi_tmp |= (BIT_14); - rtl8125_mac_ocp_write(tp, 0xE032, csi_tmp); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE0A2); + rtl8126_mac_ocp_write(tp, 0xE032, csi_tmp); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE0A2); csi_tmp |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xE0A2, csi_tmp); - break; - case CFG_METHOD_9: - case CFG_METHOD_10: - rtl8125_mac_ocp_write(tp, 0xCDD0, 0x9003); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE034); - csi_tmp |= (BIT_15 | BIT_14); - rtl8125_mac_ocp_write(tp, 0xE034, csi_tmp); - rtl8125_mac_ocp_write(tp, 0xCDD2, 0x8A71); - rtl8125_mac_ocp_write(tp, 0xCDD8, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDD4, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDDA, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDD6, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDDC, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDE8, 0x88FA); - rtl8125_mac_ocp_write(tp, 0xCDEA, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDEC, 0x89F4); - rtl8125_mac_ocp_write(tp, 0xCDEE, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDF0, 0x8C27); - rtl8125_mac_ocp_write(tp, 0xCDF2, 0x9003); - rtl8125_mac_ocp_write(tp, 0xCDF4, 0x887D); - rtl8125_mac_ocp_write(tp, 0xCDF6, 0x9003); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE032); - csi_tmp |= (BIT_14); - rtl8125_mac_ocp_write(tp, 0xE032, csi_tmp); - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE0A2); - csi_tmp |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xE0A2, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xE0A2, csi_tmp); break; } - rtl8125_enable_pci_offset_99(tp); + rtl8126_enable_pci_offset_99(tp); } static void -rtl8125_disable_pci_offset_180(struct rtl8125_private *tp) +rtl8126_disable_pci_offset_180(struct rtl8126_private *tp) { u32 csi_tmp; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE092); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE092); csi_tmp &= 0xFF00; - rtl8125_mac_ocp_write(tp, 0xE092, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xE092, csi_tmp); break; } } static void -rtl8125_enable_pci_offset_180(struct rtl8125_private *tp) +rtl8126_enable_pci_offset_180(struct rtl8126_private *tp) { u32 csi_tmp; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE094); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE094); csi_tmp &= 0x00FF; - rtl8125_mac_ocp_write(tp, 0xE094, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xE094, csi_tmp); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xE092); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xE092); csi_tmp &= 0xFF00; csi_tmp |= BIT_2; - rtl8125_mac_ocp_write(tp, 0xE092, csi_tmp); + rtl8126_mac_ocp_write(tp, 0xE092, csi_tmp); break; } } static void -rtl8125_init_pci_offset_180(struct rtl8125_private *tp) +rtl8126_init_pci_offset_180(struct rtl8126_private *tp) { - rtl8125_enable_pci_offset_180(tp); + rtl8126_enable_pci_offset_180(tp); } static void -rtl8125_set_pci_99_180_exit_driver_para(struct net_device *dev) +rtl8126_set_pci_99_180_exit_driver_para(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: if (tp->org_pci_offset_99 & BIT_2) - rtl8125_issue_offset_99_event(tp); - rtl8125_disable_pci_offset_99(tp); + rtl8126_issue_offset_99_event(tp); + rtl8126_disable_pci_offset_99(tp); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_disable_pci_offset_180(tp); + rtl8126_disable_pci_offset_180(tp); break; } } static void -rtl8125_enable_cfg9346_write(struct rtl8125_private *tp) +rtl8126_enable_cfg9346_write(struct rtl8126_private *tp) { RTL_W8(tp, Cfg9346, RTL_R8(tp, Cfg9346) | Cfg9346_Unlock); } static void -rtl8125_disable_cfg9346_write(struct rtl8125_private *tp) +rtl8126_disable_cfg9346_write(struct rtl8126_private *tp) { RTL_W8(tp, Cfg9346, RTL_R8(tp, Cfg9346) & ~Cfg9346_Unlock); } static void -rtl8125_enable_exit_l1_mask(struct rtl8125_private *tp) +rtl8126_enable_exit_l1_mask(struct rtl8126_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)); + rtl8126_set_mac_ocp_bit(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) +rtl8126_disable_exit_l1_mask(struct rtl8126_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)); + rtl8126_clear_mac_ocp_bit(tp, 0xC0AC, (BIT_7 | BIT_8 | BIT_9 | BIT_10 | BIT_11 | BIT_12)); } static void -rtl8125_enable_extend_tally_couter(struct rtl8125_private *tp) +rtl8126_enable_extend_tally_couter(struct rtl8126_private *tp) { switch (tp->HwSuppExtendTallyCounterVer) { case 1: - rtl8125_set_mac_ocp_bit(tp, 0xEA84, (BIT_1 | BIT_0)); + rtl8126_set_mac_ocp_bit(tp, 0xEA84, (BIT_1 | BIT_0)); break; } } static void -rtl8125_disable_extend_tally_couter(struct rtl8125_private *tp) +rtl8126_disable_extend_tally_couter(struct rtl8126_private *tp) { switch (tp->HwSuppExtendTallyCounterVer) { case 1: - rtl8125_clear_mac_ocp_bit(tp, 0xEA84, (BIT_1 | BIT_0)); + rtl8126_clear_mac_ocp_bit(tp, 0xEA84, (BIT_1 | BIT_0)); break; } } static void -rtl8125_enable_force_clkreq(struct rtl8125_private *tp, bool enable) +rtl8126_enable_force_clkreq(struct rtl8126_private *tp, bool enable) { if (enable) RTL_W8(tp, 0xF1, RTL_R8(tp, 0xF1) | BIT_7); @@ -5150,17 +5101,11 @@ rtl8125_enable_force_clkreq(struct rtl8125_private *tp, bool enable) } static void -rtl8125_enable_aspm_clkreq_lock(struct rtl8125_private *tp, bool enable) +rtl8126_enable_aspm_clkreq_lock(struct rtl8126_private *tp, bool enable) { 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: - rtl8125_enable_cfg9346_write(tp); + case CFG_METHOD_1: + rtl8126_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); @@ -5168,11 +5113,11 @@ rtl8125_enable_aspm_clkreq_lock(struct rtl8125_private *tp, bool enable) 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); + rtl8126_disable_cfg9346_write(tp); break; - case CFG_METHOD_9: - case CFG_METHOD_10: - rtl8125_enable_cfg9346_write(tp); + case CFG_METHOD_2: + case CFG_METHOD_3: + rtl8126_enable_cfg9346_write(tp); if (enable) { RTL_W8(tp, INT_CFG0_8125, RTL_R8(tp, INT_CFG0_8125) | BIT_3); RTL_W8(tp, Config5, RTL_R8(tp, Config5) | BIT_0); @@ -5180,103 +5125,85 @@ rtl8125_enable_aspm_clkreq_lock(struct rtl8125_private *tp, bool enable) RTL_W8(tp, INT_CFG0_8125, RTL_R8(tp, INT_CFG0_8125) & ~BIT_3); RTL_W8(tp, Config5, RTL_R8(tp, Config5) & ~BIT_0); } - rtl8125_disable_cfg9346_write(tp); + rtl8126_disable_cfg9346_write(tp); break; } } static void -rtl8125_hw_d3_para(struct net_device *dev) +rtl8126_hw_d3_para(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); RTL_W16(tp, RxMaxSize, RX_BUF_SIZE); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_enable_force_clkreq(tp, 0); - rtl8125_enable_aspm_clkreq_lock(tp, 0); + rtl8126_enable_force_clkreq(tp, 0); + rtl8126_enable_aspm_clkreq_lock(tp, 0); break; } - rtl8125_disable_exit_l1_mask(tp); + rtl8126_disable_exit_l1_mask(tp); #ifdef ENABLE_REALWOW_SUPPORT - rtl8125_set_realwow_d3_para(dev); + rtl8126_set_realwow_d3_para(dev); #endif - rtl8125_set_pci_99_180_exit_driver_para(dev); + rtl8126_set_pci_99_180_exit_driver_para(dev); - /*disable ocp phy power saving*/ - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) - rtl8125_disable_ocp_phy_power_saving(dev); + rtl8126_disable_rxdvgate(dev); - rtl8125_disable_rxdvgate(dev); - - rtl8125_disable_extend_tally_couter(tp); + rtl8126_disable_extend_tally_couter(tp); } static void -rtl8125_enable_magic_packet(struct net_device *dev) +rtl8126_enable_magic_packet(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->HwSuppMagicPktVer) { case WAKEUP_MAGIC_PACKET_V3: - rtl8125_mac_ocp_write(tp, 0xC0B6, rtl8125_mac_ocp_read(tp, 0xC0B6) | BIT_0); + rtl8126_mac_ocp_write(tp, 0xC0B6, rtl8126_mac_ocp_read(tp, 0xC0B6) | BIT_0); break; } } static void -rtl8125_disable_magic_packet(struct net_device *dev) +rtl8126_disable_magic_packet(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->HwSuppMagicPktVer) { case WAKEUP_MAGIC_PACKET_V3: - rtl8125_mac_ocp_write(tp, 0xC0B6, rtl8125_mac_ocp_read(tp, 0xC0B6) & ~BIT_0); + rtl8126_mac_ocp_write(tp, 0xC0B6, rtl8126_mac_ocp_read(tp, 0xC0B6) & ~BIT_0); break; } } static void -rtl8125_enable_linkchg_wakeup(struct net_device *dev) +rtl8126_enable_linkchg_wakeup(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(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)); + rtl8126_clear_set_mac_ocp_bit(tp, 0xE0C6, (BIT_5 | BIT_3 | BIT_2), (BIT_4 | BIT_1 | BIT_0)); break; } } static void -rtl8125_disable_linkchg_wakeup(struct net_device *dev) +rtl8126_disable_linkchg_wakeup(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(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)); + rtl8126_clear_mac_ocp_bit(tp, 0xE0C6, (BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0)); break; } } @@ -5284,7 +5211,7 @@ rtl8125_disable_linkchg_wakeup(struct net_device *dev) #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) static u32 -rtl8125_get_hw_wol(struct rtl8125_private *tp) +rtl8126_get_hw_wol(struct rtl8126_private *tp) { u8 options; u32 csi_tmp; @@ -5303,7 +5230,7 @@ rtl8125_get_hw_wol(struct rtl8125_private *tp) switch (tp->HwSuppMagicPktVer) { case WAKEUP_MAGIC_PACKET_V3: - csi_tmp = rtl8125_mac_ocp_read(tp, 0xC0B6); + csi_tmp = rtl8126_mac_ocp_read(tp, 0xC0B6); if (csi_tmp & BIT_0) wol_opts |= WAKE_MAGIC; break; @@ -5322,46 +5249,58 @@ out: } static void -rtl8125_enable_d0_speedup(struct rtl8125_private *tp) +rtl8126_enable_d0_speedup(struct rtl8126_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 (tp->HwSuppD0SpeedUpVer == 1) { + 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 if (tp->D0SpeedUpSpeed == D0_SPEED_UP_SPEED_5000) setmask = BIT_8; - rtl8125_clear_set_mac_ocp_bit(tp, 0xE10A, clearmask, setmask); + else + setmask = 0; + rtl8126_clear_set_mac_ocp_bit(tp, 0xE10A, clearmask, setmask); //speed up flowcontrol - rtl8125_set_mac_ocp_bit(tp, 0xE860, (BIT_15 | BIT_14)); + clearmask = (BIT_15 | BIT_14); + if (tp->HwSuppD0SpeedUpVer == 2) + clearmask |= BIT_13; - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_3); + if (tp->fcpause == rtl8126_fc_full) { + setmask = (BIT_15 | BIT_14); + if (tp->HwSuppD0SpeedUpVer == 2) + setmask |= BIT_13; + } else + setmask = 0; + rtl8126_clear_set_mac_ocp_bit(tp, 0xE860, clearmask, setmask); } + + RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_3); } static void -rtl8125_disable_d0_speedup(struct rtl8125_private *tp) +rtl8126_disable_d0_speedup(struct rtl8126_private *tp) { if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; - if (tp->HwSuppD0SpeedUpVer == 1) - RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_3); + RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~BIT_3); } static void -rtl8125_set_hw_wol(struct net_device *dev, u32 wolopts) +rtl8126_set_hw_wol(struct net_device *dev, u32 wolopts) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i,tmp; static struct { u32 opt; @@ -5382,13 +5321,13 @@ rtl8125_set_hw_wol(struct net_device *dev, u32 wolopts) tmp = ARRAY_SIZE(cfg) - 1; if (wolopts & WAKE_MAGIC) - rtl8125_enable_magic_packet(dev); + rtl8126_enable_magic_packet(dev); else - rtl8125_disable_magic_packet(dev); + rtl8126_disable_magic_packet(dev); break; } - rtl8125_enable_cfg9346_write(tp); + rtl8126_enable_cfg9346_write(tp); for (i = 0; i < tmp; i++) { u8 options = RTL_R8(tp, cfg[i].reg) & ~cfg[i].mask; @@ -5400,33 +5339,35 @@ rtl8125_set_hw_wol(struct net_device *dev, u32 wolopts) switch (tp->HwSuppLinkChgWakeUpVer) { case 3: if (wolopts & WAKE_PHY) - rtl8125_enable_linkchg_wakeup(dev); + rtl8126_enable_linkchg_wakeup(dev); else - rtl8125_disable_linkchg_wakeup(dev); + rtl8126_disable_linkchg_wakeup(dev); break; } - rtl8125_disable_cfg9346_write(tp); + rtl8126_disable_cfg9346_write(tp); } static void -rtl8125_phy_restart_nway(struct net_device *dev) +rtl8126_phy_restart_nway(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (rtl8125_is_in_phy_disable_mode(dev)) return; + if (rtl8126_is_in_phy_disable_mode(dev)) + return; - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); } static void -rtl8125_phy_setup_force_mode(struct net_device *dev, u32 speed, u8 duplex) +rtl8126_phy_setup_force_mode(struct net_device *dev, u32 speed, u8 duplex) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 bmcr_true_force = 0; - if (rtl8125_is_in_phy_disable_mode(dev)) return; + if (rtl8126_is_in_phy_disable_mode(dev)) + return; if ((speed == SPEED_10) && (duplex == DUPLEX_HALF)) { bmcr_true_force = BMCR_SPEED10; @@ -5441,12 +5382,12 @@ rtl8125_phy_setup_force_mode(struct net_device *dev, u32 speed, u8 duplex) return; } - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, bmcr_true_force); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, MII_BMCR, bmcr_true_force); } static void -rtl8125_set_pci_pme(struct rtl8125_private *tp, int set) +rtl8126_set_pci_pme(struct rtl8126_private *tp, int set) { struct pci_dev *pdev = tp->pci_dev; u16 pmc; @@ -5464,13 +5405,13 @@ rtl8125_set_pci_pme(struct rtl8125_private *tp, int set) } static void -rtl8125_set_wol_link_speed(struct net_device *dev) +rtl8126_set_wol_link_speed(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int auto_nego; int giga_ctrl; int ctrl_2500; - u32 adv; + u64 adv; u16 anlpar; u16 gbsr; u16 status_2500; @@ -5479,29 +5420,27 @@ rtl8125_set_wol_link_speed(struct net_device *dev) if (tp->autoneg != AUTONEG_ENABLE) goto exit; - rtl8125_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, 0x1F, 0x0000); - auto_nego = rtl8125_mdio_read(tp, MII_ADVERTISE); + auto_nego = rtl8126_mdio_read(tp, MII_ADVERTISE); auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL); - giga_ctrl = rtl8125_mdio_read(tp, MII_CTRL1000); + giga_ctrl = rtl8126_mdio_read(tp, MII_CTRL1000); giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); - ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); - ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL); - if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) - ctrl_2500 &= ~RTK_ADVERTISE_5000FULL; + ctrl_2500 = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D4); + ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL | RTK_ADVERTISE_5000FULL); aner = tp->phy_reg_aner; anlpar = tp->phy_reg_anlpar; gbsr = tp->phy_reg_gbsr; status_2500 = tp->phy_reg_status_2500; if (tp->link_ok(dev)) { - aner = rtl8125_mdio_read(tp, MII_EXPANSION); - anlpar = rtl8125_mdio_read(tp, MII_LPA); - gbsr = rtl8125_mdio_read(tp, MII_STAT1000); - status_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D6); + aner = rtl8126_mdio_read(tp, MII_EXPANSION); + anlpar = rtl8126_mdio_read(tp, MII_LPA); + gbsr = rtl8126_mdio_read(tp, MII_STAT1000); + status_2500 = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D6); } adv = tp->advertising; @@ -5552,20 +5491,20 @@ skip_check_lpa: auto_nego |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10HALF | ADVERTISE_10FULL); #endif - rtl8125_mdio_write(tp, MII_ADVERTISE, auto_nego); - rtl8125_mdio_write(tp, MII_CTRL1000, giga_ctrl); - mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); + rtl8126_mdio_write(tp, MII_ADVERTISE, auto_nego); + rtl8126_mdio_write(tp, MII_CTRL1000, giga_ctrl); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); - rtl8125_phy_restart_nway(dev); + rtl8126_phy_restart_nway(dev); exit: return; } static bool -rtl8125_keep_wol_link_speed(struct net_device *dev, u8 from_suspend) +rtl8126_keep_wol_link_speed(struct net_device *dev, u8 from_suspend) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if ((from_suspend && !tp->link_ok(dev)) || (!from_suspend && tp->resume_not_chg_speed)) @@ -5574,41 +5513,37 @@ rtl8125_keep_wol_link_speed(struct net_device *dev, u8 from_suspend) return 0; } static void -rtl8125_powerdown_pll(struct net_device *dev, u8 from_suspend) +rtl8126_powerdown_pll(struct net_device *dev, u8 from_suspend) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); tp->check_keep_link_speed = 0; if (tp->wol_enabled == WOL_ENABLED || tp->DASH || tp->EnableKCPOffload) { - rtl8125_set_hw_wol(dev, tp->wol_opts); + rtl8126_set_hw_wol(dev, tp->wol_opts); - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) { - rtl8125_enable_cfg9346_write(tp); + switch (tp->mcfg) { + case CFG_METHOD_1 ... CFG_METHOD_3: + rtl8126_enable_cfg9346_write(tp); RTL_W8(tp, Config2, RTL_R8(tp, Config2) | PMSTS_En); - rtl8125_disable_cfg9346_write(tp); - } + rtl8126_disable_cfg9346_write(tp); + break; + default: + break; + }; /* Enable the PME and clear the status */ - rtl8125_set_pci_pme(tp, 1); + rtl8126_set_pci_pme(tp, 1); - if (rtl8125_keep_wol_link_speed(dev, from_suspend)) { + if (rtl8126_keep_wol_link_speed(dev, from_suspend)) { if (tp->wol_opts & WAKE_PHY) tp->check_keep_link_speed = 1; } else { if (HW_SUPPORT_D0_SPEED_UP(tp)) { - rtl8125_enable_d0_speedup(tp); + rtl8126_enable_d0_speedup(tp); tp->check_keep_link_speed = 1; } - rtl8125_set_wol_link_speed(dev); + rtl8126_set_wol_link_speed(dev); } RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | AcceptBroadcast | AcceptMulticast | AcceptMyPhys); @@ -5619,68 +5554,51 @@ rtl8125_powerdown_pll(struct net_device *dev, u8 from_suspend) if (tp->DASH) return; - rtl8125_phy_power_down(dev); + rtl8126_phy_power_down(dev); if (!tp->HwIcVerUnknown) { switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W8(tp, PMCH, RTL_R8(tp, PMCH) & ~BIT_7); break; } } switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W8(tp, 0xF2, RTL_R8(tp, 0xF2) & ~BIT_6); break; } } -static void rtl8125_powerup_pll(struct net_device *dev) +static void rtl8126_powerup_pll(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: 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); + rtl8126_phy_power_up(dev); } #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static void -rtl8125_get_wol(struct net_device *dev, +rtl8126_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u8 options; wol->wolopts = 0; @@ -5700,10 +5618,10 @@ rtl8125_get_wol(struct net_device *dev, } static int -rtl8125_set_wol(struct net_device *dev, +rtl8126_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (tp->mcfg == CFG_METHOD_DEFAULT || disable_wol_support) return -EOPNOTSUPP; @@ -5718,16 +5636,16 @@ rtl8125_set_wol(struct net_device *dev, } static void -rtl8125_get_drvinfo(struct net_device *dev, +rtl8126_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_fw *rtl_fw = tp->rtl_fw; + struct rtl8126_private *tp = netdev_priv(dev); + struct rtl8126_fw *rtl_fw = tp->rtl_fw; strscpy(info->driver, MODULENAME, sizeof(info->driver)); - strscpy(info->version, RTL8125_VERSION, sizeof(info->version)); + strscpy(info->version, RTL8126_VERSION, sizeof(info->version)); strscpy(info->bus_info, pci_name(tp->pci_dev), sizeof(info->bus_info)); - info->regdump_len = R8125_REGS_DUMP_SIZE; + info->regdump_len = R8126_REGS_DUMP_SIZE; info->eedump_len = tp->eeprom_len; BUILD_BUG_ON(sizeof(info->fw_version) < sizeof(rtl_fw->version)); if (rtl_fw) @@ -5736,14 +5654,14 @@ rtl8125_get_drvinfo(struct net_device *dev, } static int -rtl8125_get_regs_len(struct net_device *dev) +rtl8126_get_regs_len(struct net_device *dev) { - return R8125_REGS_DUMP_SIZE; + return R8126_REGS_DUMP_SIZE; } #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static void -rtl8125_set_d0_speedup_speed(struct rtl8125_private *tp) +rtl8126_set_d0_speedup_speed(struct rtl8126_private *tp) { if (FALSE == HW_SUPPORT_D0_SPEED_UP(tp)) return; @@ -5754,48 +5672,44 @@ rtl8125_set_d0_speedup_speed(struct rtl8125_private *tp) tp->D0SpeedUpSpeed = D0_SPEED_UP_SPEED_5000; else 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; } } static int -rtl8125_set_speed_xmii(struct net_device *dev, +rtl8126_set_speed_xmii(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, u64 adv) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int auto_nego = 0; int giga_ctrl = 0; int ctrl_2500 = 0; 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); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_9); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA5EA, BIT_0); if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5EA, BIT_1); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA5EA, BIT_1); - if (speed != SPEED_5000 && - speed != SPEED_2500 && - (speed != SPEED_1000) && - (speed != SPEED_100) && - (speed != SPEED_10)) { - speed = SPEED_2500; + if (!rtl8126_is_speed_mode_valid(speed)) { + speed = SPEED_5000; duplex = DUPLEX_FULL; adv |= tp->advertising; } - giga_ctrl = rtl8125_mdio_read(tp, MII_CTRL1000); + giga_ctrl = rtl8126_mdio_read(tp, MII_CTRL1000); giga_ctrl &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL); - ctrl_2500 = mdio_direct_read_phy_ocp(tp, 0xA5D4); + ctrl_2500 = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D4); ctrl_2500 &= ~(RTK_ADVERTISE_2500FULL | RTK_ADVERTISE_5000FULL); if (autoneg == AUTONEG_ENABLE) { /*n-way force*/ - auto_nego = rtl8125_mdio_read(tp, MII_ADVERTISE); + auto_nego = rtl8126_mdio_read(tp, MII_ADVERTISE); auto_nego &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL | ADVERTISE_100HALF | ADVERTISE_100FULL | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM); @@ -5820,7 +5734,7 @@ rtl8125_set_speed_xmii(struct net_device *dev, } //flow control - if (tp->fcpause == rtl8125_fc_full) + if (tp->fcpause == rtl8126_fc_full) auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; tp->phy_auto_nego_reg = auto_nego; @@ -5828,16 +5742,16 @@ rtl8125_set_speed_xmii(struct net_device *dev, tp->phy_2500_ctrl_reg = ctrl_2500; - rtl8125_mdio_write(tp, 0x1f, 0x0000); - rtl8125_mdio_write(tp, MII_ADVERTISE, auto_nego); - rtl8125_mdio_write(tp, MII_CTRL1000, giga_ctrl); - mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); - rtl8125_phy_restart_nway(dev); + rtl8126_mdio_write(tp, 0x1f, 0x0000); + rtl8126_mdio_write(tp, MII_ADVERTISE, auto_nego); + rtl8126_mdio_write(tp, MII_CTRL1000, giga_ctrl); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA5D4, ctrl_2500); + rtl8126_phy_restart_nway(dev); mdelay(20); } else { /*true force*/ if (speed == SPEED_10 || speed == SPEED_100) - rtl8125_phy_setup_force_mode(dev, speed, duplex); + rtl8126_phy_setup_force_mode(dev, speed, duplex); else goto out; } @@ -5847,7 +5761,7 @@ rtl8125_set_speed_xmii(struct net_device *dev, tp->duplex = duplex; tp->advertising = adv; - rtl8125_set_d0_speedup_speed(tp); + rtl8126_set_d0_speedup_speed(tp); rc = 0; out: @@ -5855,16 +5769,17 @@ out: } static int -rtl8125_set_speed(struct net_device *dev, +rtl8126_set_speed(struct net_device *dev, u8 autoneg, u32 speed, u8 duplex, u64 adv) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_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); @@ -5873,7 +5788,7 @@ rtl8125_set_speed(struct net_device *dev, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static int -rtl8125_set_settings(struct net_device *dev, +rtl8126_set_settings(struct net_device *dev, #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) struct ethtool_cmd *cmd #else @@ -5894,7 +5809,7 @@ rtl8125_set_settings(struct net_device *dev, supported = cmd->supported; advertising = cmd->advertising; #else - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); const struct ethtool_link_settings *base = &cmd->base; autoneg = base->autoneg; speed = base->speed; @@ -5921,16 +5836,16 @@ rtl8125_set_settings(struct net_device *dev, if (advertising & ~supported) return -EINVAL; - ret = rtl8125_set_speed(dev, autoneg, speed, duplex, advertising); + ret = rtl8126_set_speed(dev, autoneg, speed, duplex, advertising); return ret; } #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) static u32 -rtl8125_get_tx_csum(struct net_device *dev) +rtl8126_get_tx_csum(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u32 ret; #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) @@ -5943,9 +5858,9 @@ rtl8125_get_tx_csum(struct net_device *dev) } static u32 -rtl8125_get_rx_csum(struct net_device *dev) +rtl8126_get_rx_csum(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u32 ret; ret = tp->cp_cmd & RxChkSum; @@ -5954,10 +5869,10 @@ rtl8125_get_rx_csum(struct net_device *dev) } static int -rtl8125_set_tx_csum(struct net_device *dev, +rtl8126_set_tx_csum(struct net_device *dev, u32 data) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (tp->mcfg == CFG_METHOD_DEFAULT) return -EOPNOTSUPP; @@ -5978,10 +5893,10 @@ rtl8125_set_tx_csum(struct net_device *dev, } static int -rtl8125_set_rx_csum(struct net_device *dev, +rtl8126_set_rx_csum(struct net_device *dev, u32 data) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (tp->mcfg == CFG_METHOD_DEFAULT) return -EOPNOTSUPP; @@ -5999,7 +5914,7 @@ rtl8125_set_rx_csum(struct net_device *dev, #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static u32 -rtl8125_rx_desc_opts1(struct rtl8125_private *tp, +rtl8126_rx_desc_opts1(struct rtl8126_private *tp, struct RxDesc *desc) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) @@ -6009,7 +5924,7 @@ rtl8125_rx_desc_opts1(struct rtl8125_private *tp, } static u32 -rtl8125_rx_desc_opts2(struct rtl8125_private *tp, +rtl8126_rx_desc_opts2(struct rtl8126_private *tp, struct RxDesc *desc) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) @@ -6018,10 +5933,10 @@ rtl8125_rx_desc_opts2(struct rtl8125_private *tp, return desc->opts2; } -#ifdef CONFIG_R8125_VLAN +#ifdef CONFIG_R8126_VLAN static void -rtl8125_clear_rx_desc_opts2(struct rtl8125_private *tp, +rtl8126_clear_rx_desc_opts2(struct rtl8126_private *tp, struct RxDesc *desc) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) @@ -6031,7 +5946,7 @@ rtl8125_clear_rx_desc_opts2(struct rtl8125_private *tp, } static inline u32 -rtl8125_tx_vlan_tag(struct rtl8125_private *tp, +rtl8126_tx_vlan_tag(struct rtl8126_private *tp, struct sk_buff *skb) { #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) @@ -6051,28 +5966,22 @@ rtl8125_tx_vlan_tag(struct rtl8125_private *tp, #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) static void -rtl8125_vlan_rx_register(struct net_device *dev, +rtl8126_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); tp->vlgrp = grp; switch (tp->mcfg) { + case CFG_METHOD_1: 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: if (tp->vlgrp) { - tp->rtl8125_rx_config |= (EnableInnerVlan | EnableOuterVlan); + tp->rtl8126_rx_config |= (EnableInnerVlan | EnableOuterVlan); RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) | (EnableInnerVlan | EnableOuterVlan)) } else { - tp->rtl8125_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); + tp->rtl8126_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) & ~(EnableInnerVlan | EnableOuterVlan)) } break; @@ -6083,10 +5992,10 @@ rtl8125_vlan_rx_register(struct net_device *dev, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) static void -rtl8125_vlan_rx_kill_vid(struct net_device *dev, +rtl8126_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) if (tp->vlgrp) @@ -6098,16 +6007,16 @@ rtl8125_vlan_rx_kill_vid(struct net_device *dev, #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) static int -rtl8125_rx_vlan_skb(struct rtl8125_private *tp, +rtl8126_rx_vlan_skb(struct rtl8126_private *tp, struct RxDesc *desc, struct sk_buff *skb) { - u32 opts2 = le32_to_cpu(rtl8125_rx_desc_opts2(tp, desc)); + u32 opts2 = le32_to_cpu(rtl8126_rx_desc_opts2(tp, desc)); int ret = -1; #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) if (tp->vlgrp && (opts2 & RxVlanTag)) { - rtl8125_rx_hwaccel_skb(skb, tp->vlgrp, + rtl8126_rx_hwaccel_skb(skb, tp->vlgrp, swab16(opts2 & 0xffff)); ret = 0; } @@ -6119,21 +6028,21 @@ rtl8125_rx_vlan_skb(struct rtl8125_private *tp, __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), swab16(opts2 & 0xffff)); #endif - rtl8125_clear_rx_desc_opts2(tp, desc); + rtl8126_clear_rx_desc_opts2(tp, desc); return ret; } -#else /* !CONFIG_R8125_VLAN */ +#else /* !CONFIG_R8126_VLAN */ static inline u32 -rtl8125_tx_vlan_tag(struct rtl8125_private *tp, +rtl8126_tx_vlan_tag(struct rtl8126_private *tp, struct sk_buff *skb) { return 0; } static int -rtl8125_rx_vlan_skb(struct rtl8125_private *tp, +rtl8126_rx_vlan_skb(struct rtl8126_private *tp, struct RxDesc *desc, struct sk_buff *skb) { @@ -6144,7 +6053,7 @@ rtl8125_rx_vlan_skb(struct rtl8125_private *tp, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) -static netdev_features_t rtl8125_fix_features(struct net_device *dev, +static netdev_features_t rtl8126_fix_features(struct net_device *dev, netdev_features_t features) { if (dev->mtu > MSS_MAX) @@ -6153,33 +6062,33 @@ static netdev_features_t rtl8125_fix_features(struct net_device *dev, features &= ~NETIF_F_ALL_TSO; features &= ~NETIF_F_ALL_CSUM; } -#ifndef CONFIG_R8125_VLAN +#ifndef CONFIG_R8126_VLAN features &= ~NETIF_F_ALL_CSUM; #endif return features; } -static int rtl8125_hw_set_features(struct net_device *dev, +static int rtl8126_hw_set_features(struct net_device *dev, netdev_features_t features) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u32 rx_config; rx_config = RTL_R32(tp, RxConfig); if (features & NETIF_F_RXALL) { - tp->rtl8125_rx_config |= (AcceptErr | AcceptRunt); + tp->rtl8126_rx_config |= (AcceptErr | AcceptRunt); rx_config |= (AcceptErr | AcceptRunt); } else { - tp->rtl8125_rx_config &= ~(AcceptErr | AcceptRunt); + tp->rtl8126_rx_config &= ~(AcceptErr | AcceptRunt); rx_config &= ~(AcceptErr | AcceptRunt); } if (features & NETIF_F_HW_VLAN_RX) { - tp->rtl8125_rx_config |= (EnableInnerVlan | EnableOuterVlan); + tp->rtl8126_rx_config |= (EnableInnerVlan | EnableOuterVlan); rx_config |= (EnableInnerVlan | EnableOuterVlan); } else { - tp->rtl8125_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); + tp->rtl8126_rx_config &= ~(EnableInnerVlan | EnableOuterVlan); rx_config &= ~(EnableInnerVlan | EnableOuterVlan); } @@ -6196,19 +6105,30 @@ static int rtl8125_hw_set_features(struct net_device *dev, return 0; } -static int rtl8125_set_features(struct net_device *dev, +static int rtl8126_set_features(struct net_device *dev, netdev_features_t features) { features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX; - rtl8125_hw_set_features(dev, features); + rtl8126_hw_set_features(dev, features); return 0; } #endif -static void rtl8125_gset_xmii(struct net_device *dev, +static u8 rtl8126_get_mdi_status(struct rtl8126_private *tp) +{ + if (!tp->link_ok(tp->dev)) + return ETH_TP_MDI_INVALID; + + if (rtl8126_mdio_direct_read_phy_ocp(tp, 0xA444) & BIT_1) + return ETH_TP_MDI; + else + return ETH_TP_MDI_X; +} + +static void rtl8126_gset_xmii(struct net_device *dev, #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) struct ethtool_cmd *cmd #else @@ -6216,12 +6136,12 @@ static void rtl8125_gset_xmii(struct net_device *dev, #endif ) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 aner = tp->phy_reg_aner; u16 anlpar = tp->phy_reg_anlpar; u16 gbsr = tp->phy_reg_gbsr; u16 status_2500 = tp->phy_reg_status_2500; - u32 lpa_adv = 0; + u64 lpa_adv = 0; u16 status; u8 autoneg, duplex; u32 speed = 0; @@ -6245,7 +6165,7 @@ static void rtl8125_gset_xmii(struct net_device *dev, advertising = tp->advertising; 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; @@ -6259,10 +6179,12 @@ static void rtl8125_gset_xmii(struct net_device *dev, advertising |= ADVERTISED_1000baseT_Full; if (tp->phy_2500_ctrl_reg & RTK_ADVERTISE_2500FULL) advertising |= ADVERTISED_2500baseX_Full; + if (tp->phy_2500_ctrl_reg & RTK_ADVERTISE_5000FULL) + advertising |= RTK_ADVERTISED_5000baseX_Full; } - rtl8125_mdio_write(tp, 0x1F, 0x0000); - bmcr = rtl8125_mdio_read(tp, MII_BMCR); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + bmcr = rtl8126_mdio_read(tp, MII_BMCR); if (bmcr & BMCR_ANENABLE) { autoneg = AUTONEG_ENABLE; advertising |= ADVERTISED_Autoneg; @@ -6278,7 +6200,7 @@ static void rtl8125_gset_xmii(struct net_device *dev, if (report_lpa) { /*link on*/ - speed = rtl8125_convert_link_speed(status); + speed = rtl8126_convert_link_speed(status); if (status & TxFlowCtrl) advertising |= ADVERTISED_Asym_Pause; @@ -6311,6 +6233,8 @@ static void rtl8125_gset_xmii(struct net_device *dev, lpa_adv |= ADVERTISED_1000baseT_Full; if (status_2500 & RTK_LPA_ADVERTISE_2500FULL) lpa_adv |= ADVERTISED_2500baseX_Full; + if (status_2500 & RTK_LPA_ADVERTISE_5000FULL) + lpa_adv |= RTK_ADVERTISED_5000baseX_Full; } else { /*link down*/ speed = SPEED_UNKNOWN; @@ -6325,7 +6249,8 @@ static void rtl8125_gset_xmii(struct net_device *dev, cmd->speed = speed; cmd->duplex = duplex; cmd->port = PORT_TP; - cmd->lp_advertising = lpa_adv; + cmd->lp_advertising = (u32)lpa_adv; + cmd->eth_tp_mdix = rtl8126_get_mdi_status(tp); #else ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, supported); @@ -6359,24 +6284,22 @@ 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) + if (lpa_adv & RTK_ADVERTISED_5000baseX_Full) 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 = rtl8126_get_mdi_status(tp); #endif } #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static int -rtl8125_get_settings(struct net_device *dev, +rtl8126_get_settings(struct net_device *dev, #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) struct ethtool_cmd *cmd #else @@ -6384,93 +6307,87 @@ rtl8125_get_settings(struct net_device *dev, #endif ) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); tp->get_settings(dev, cmd); return 0; } -static void rtl8125_get_regs(struct net_device *dev, struct ethtool_regs *regs, +static void rtl8126_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; unsigned int i; u8 *data = p; - if (regs->len < R8125_REGS_DUMP_SIZE) + if (regs->len < R8126_REGS_DUMP_SIZE) return /* -EINVAL */; memset(p, 0, regs->len); - for (i = 0; i < R8125_MAC_REGS_SIZE; i++) + for (i = 0; i < R8126_MAC_REGS_SIZE; i++) *data++ = readb(ioaddr + i); data = (u8*)p + 256; - rtl8125_mdio_write(tp, 0x1F, 0x0000); - for (i = 0; i < R8125_PHY_REGS_SIZE/2; i++) { - *(u16*)data = rtl8125_mdio_read(tp, i); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + for (i = 0; i < R8126_PHY_REGS_SIZE/2; i++) { + *(u16*)data = rtl8126_mdio_read(tp, i); data += 2; } data = (u8*)p + 256 * 2; - for (i = 0; i < R8125_EPHY_REGS_SIZE/2; i++) { - *(u16*)data = rtl8125_ephy_read(tp, i); + for (i = 0; i < R8126_EPHY_REGS_SIZE/2; i++) { + *(u16*)data = rtl8126_ephy_read(tp, i); data += 2; } data = (u8*)p + 256 * 3; switch (tp->mcfg) { + case CFG_METHOD_1: 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: default: - for (i = 0; i < R8125_ERI_REGS_SIZE; i+=4) { - *(u32*)data = rtl8125_eri_read(tp, i , 4, ERIAR_ExGMAC); + for (i = 0; i < R8126_ERI_REGS_SIZE; i+=4) { + *(u32*)data = rtl8126_eri_read(tp, i , 4, ERIAR_ExGMAC); data += 4; } break; } } -static void rtl8125_get_pauseparam(struct net_device *dev, +static void rtl8126_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); pause->autoneg = (tp->autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); - if (tp->fcpause == rtl8125_fc_rx_pause) + if (tp->fcpause == rtl8126_fc_rx_pause) pause->rx_pause = 1; - else if (tp->fcpause == rtl8125_fc_tx_pause) + else if (tp->fcpause == rtl8126_fc_tx_pause) pause->tx_pause = 1; - else if (tp->fcpause == rtl8125_fc_full) { + else if (tp->fcpause == rtl8126_fc_full) { pause->rx_pause = 1; pause->tx_pause = 1; } } -static int rtl8125_set_pauseparam(struct net_device *dev, +static int rtl8126_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause) { - struct rtl8125_private *tp = netdev_priv(dev); - enum rtl8125_fc_mode newfc; + struct rtl8126_private *tp = netdev_priv(dev); + enum rtl8126_fc_mode newfc; if (pause->tx_pause || pause->rx_pause) - newfc = rtl8125_fc_full; + newfc = rtl8126_fc_full; else - newfc = rtl8125_fc_none; + newfc = rtl8126_fc_none; if (tp->fcpause != newfc) { tp->fcpause = newfc; - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); } return 0; @@ -6478,23 +6395,23 @@ static int rtl8125_set_pauseparam(struct net_device *dev, } static u32 -rtl8125_get_msglevel(struct net_device *dev) +rtl8126_get_msglevel(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); return tp->msg_enable; } static void -rtl8125_set_msglevel(struct net_device *dev, +rtl8126_set_msglevel(struct net_device *dev, u32 value) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); tp->msg_enable = value; } -static const char rtl8125_gstrings[][ETH_GSTRING_LEN] = { +static const char rtl8126_gstrings[][ETH_GSTRING_LEN] = { /* legacy */ "tx_packets", "rx_packets", @@ -6542,17 +6459,17 @@ static const char rtl8125_gstrings[][ETH_GSTRING_LEN] = { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static int rtl8125_get_stats_count(struct net_device *dev) +static int rtl8126_get_stats_count(struct net_device *dev) { - return ARRAY_SIZE(rtl8125_gstrings); + return ARRAY_SIZE(rtl8126_gstrings); } #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) #else -static int rtl8125_get_sset_count(struct net_device *dev, int sset) +static int rtl8126_get_sset_count(struct net_device *dev, int sset) { switch (sset) { case ETH_SS_STATS: - return ARRAY_SIZE(rtl8125_gstrings); + return ARRAY_SIZE(rtl8126_gstrings); default: return -EOPNOTSUPP; } @@ -6560,29 +6477,29 @@ static int rtl8125_get_sset_count(struct net_device *dev, int sset) #endif static void -rtl8125_set_ring_size(struct rtl8125_private *tp, u32 rx, u32 tx) +rtl8126_set_ring_size(struct rtl8126_private *tp, u32 rx, u32 tx) { int i; - for (i = 0; i < R8125_MAX_RX_QUEUES; i++) + for (i = 0; i < R8126_MAX_RX_QUEUES; i++) tp->rx_ring[i].num_rx_desc = rx; - for (i = 0; i < R8125_MAX_TX_QUEUES; i++) + for (i = 0; i < R8126_MAX_TX_QUEUES; i++) tp->tx_ring[i].num_tx_desc = tx; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) -static void rtl8125_get_ringparam(struct net_device *dev, +static void rtl8126_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring, struct kernel_ethtool_ringparam *kernel_ring, struct netlink_ext_ack *extack) #else -static void rtl8125_get_ringparam(struct net_device *dev, +static void rtl8126_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); ring->rx_max_pending = MAX_NUM_TX_DESC; ring->tx_max_pending = MAX_NUM_RX_DESC; @@ -6591,16 +6508,16 @@ static void rtl8125_get_ringparam(struct net_device *dev, } #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) -static int rtl8125_set_ringparam(struct net_device *dev, +static int rtl8126_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring, struct kernel_ethtool_ringparam *kernel_ring, struct netlink_ext_ack *extack) #else -static int rtl8125_set_ringparam(struct net_device *dev, +static int rtl8126_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring) #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u32 new_rx_count, new_tx_count; int rc = 0; @@ -6620,14 +6537,14 @@ static int rtl8125_set_ringparam(struct net_device *dev, } if (netif_running(dev)) { - rtl8125_wait_for_quiescence(dev); - rtl8125_close(dev); + rtl8126_wait_for_quiescence(dev); + rtl8126_close(dev); } - rtl8125_set_ring_size(tp, new_rx_count, new_tx_count); + rtl8126_set_ring_size(tp, new_rx_count, new_tx_count); if (netif_running(dev)) - rc = rtl8125_open(dev); + rc = rtl8126_open(dev); return rc; } @@ -6635,12 +6552,12 @@ static int rtl8125_set_ringparam(struct net_device *dev, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static void -rtl8125_get_ethtool_stats(struct net_device *dev, +rtl8126_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { - struct rtl8125_private *tp = netdev_priv(dev); - struct rtl8125_counters *counters; + struct rtl8126_private *tp = netdev_priv(dev); + struct rtl8126_counters *counters; dma_addr_t paddr; ASSERT_RTNL(); @@ -6650,7 +6567,7 @@ rtl8125_get_ethtool_stats(struct net_device *dev, if (!counters) return; - rtl8125_dump_tally_counter(tp, paddr); + rtl8126_dump_tally_counter(tp, paddr); data[0] = le64_to_cpu(counters->tx_packets); data[1] = le64_to_cpu(counters->rx_packets); @@ -6695,13 +6612,13 @@ rtl8125_get_ethtool_stats(struct net_device *dev, } static void -rtl8125_get_strings(struct net_device *dev, +rtl8126_get_strings(struct net_device *dev, u32 stringset, u8 *data) { switch (stringset) { case ETH_SS_STATS: - memcpy(data, rtl8125_gstrings, sizeof(rtl8125_gstrings)); + memcpy(data, rtl8126_gstrings, sizeof(rtl8126_gstrings)); break; } } @@ -6709,14 +6626,14 @@ rtl8125_get_strings(struct net_device *dev, static int rtl_get_eeprom_len(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); return tp->eeprom_len; } static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *buf) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i,j,ret; int start_w, end_w; int VPD_addr, VPD_data; @@ -6732,15 +6649,9 @@ static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, } switch (tp->mcfg) { + case CFG_METHOD_1: 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: default: VPD_addr = 0xD2; VPD_data = 0xD4; @@ -6754,7 +6665,7 @@ static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, if (!eeprom_buff) return -ENOMEM; - rtl8125_enable_cfg9346_write(tp); + rtl8126_enable_cfg9346_write(tp); ret = -EFAULT; for (i=start_w; i<=end_w; i++) { pci_write_config_word(tp->pci_dev, VPD_addr, (u16)i*4); @@ -6773,7 +6684,7 @@ static int rtl_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, pci_read_config_dword(tp->pci_dev, VPD_data, &eeprom_buff[i-start_w]); } - rtl8125_disable_cfg9346_write(tp); + rtl8126_disable_cfg9346_write(tp); if (!ret) memcpy(buf, (u8 *)eeprom_buff + (eeprom->offset & 3), eeprom->len); @@ -6806,7 +6717,7 @@ static u32 _kc_ethtool_op_get_sg(struct net_device *dev) #define ethtool_op_set_sg _kc_ethtool_op_set_sg static int _kc_ethtool_op_set_sg(struct net_device *dev, u32 data) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); if (tp->mcfg == CFG_METHOD_DEFAULT) return -EOPNOTSUPP; @@ -6823,22 +6734,16 @@ 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) +rtl8126_set_eee_lpi_timer(struct rtl8126_private *tp) { u16 dev_lpi_timer; dev_lpi_timer = tp->eee.tx_lpi_timer; switch (tp->mcfg) { + case CFG_METHOD_1: 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: RTL_W16(tp, EEE_TXIDLE_TIMER_8125, dev_lpi_timer); break; default: @@ -6846,7 +6751,52 @@ rtl8125_set_eee_lpi_timer(struct rtl8125_private *tp) } } -static int rtl8125_enable_eee(struct rtl8125_private *tp) +static bool rtl8126_is_adv_eee_enabled(struct rtl8126_private *tp) +{ + switch (tp->mcfg) { + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + if (rtl8126_mdio_direct_read_phy_ocp(tp, 0xA430) & BIT_15) + return true; + break; + default: + break; + } + + return false; +} + +static void rtl8126_disable_adv_eee(struct rtl8126_private *tp) +{ + bool lock; + + switch (tp->mcfg) { + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + break; + default: + return; + } + + if (rtl8126_is_adv_eee_enabled(tp)) + lock = true; + else + lock = false; + + if (lock) + rtl8126_set_phy_mcu_patch_request(tp); + + rtl8126_clear_mac_ocp_bit(tp, 0xE052, BIT_0); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA442, BIT_12 | BIT_13); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA430, BIT_15); + + if (lock) + rtl8126_clear_phy_mcu_patch_request(tp); +} + +static int rtl8126_enable_eee(struct rtl8126_private *tp) { struct ethtool_eee *eee = &tp->eee; u16 eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(eee->advertised); @@ -6854,154 +6804,83 @@ static int rtl8125_enable_eee(struct rtl8125_private *tp) ret = 0; switch (tp->mcfg) { + case CFG_METHOD_1: 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)); + rtl8126_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_t); - 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_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - rtl8125_set_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA5D0, MDIO_EEE_100TX | MDIO_EEE_1000T, eee_adv_t); if (eee->advertised & SUPPORTED_2500baseX_Full) - rtl8125_set_eth_phy_ocp_bit(tp, 0xA6D4, BIT_0); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); else - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, BIT_0); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, BIT_1); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_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); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA4A2, BIT_9); break; default: - //dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEE\n"); ret = -EOPNOTSUPP; break; } /*Advanced EEE*/ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - 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); - rtl8125_clear_phy_mcu_patch_request(tp); - break; - } + rtl8126_disable_adv_eee(tp); return ret; } -static int rtl8125_disable_eee(struct rtl8125_private *tp) +static int rtl8126_disable_eee(struct rtl8126_private *tp) { int ret; ret = 0; switch (tp->mcfg) { + case CFG_METHOD_1: 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)); + rtl8126_clear_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA432, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5D0, (BIT_2 | BIT_1)); - 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_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - rtl8125_clear_mac_ocp_bit(tp, 0xE040, (BIT_1|BIT_0)); - - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5D0, (BIT_2 | BIT_1)); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, BIT_0); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA5D0, (MDIO_EEE_100TX | MDIO_EEE_1000T)); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA6D4, BIT_1); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_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); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA4A2, BIT_9); break; default: -// dev_printk(KERN_DEBUG, tp_to_dev(tp), "Not Support EEE\n"); ret = -EOPNOTSUPP; break; } /*Advanced EEE*/ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - 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); - rtl8125_clear_phy_mcu_patch_request(tp); - break; - } + rtl8126_disable_adv_eee(tp); return ret; } static int rtl_nway_reset(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ret, bmcr; if (unlikely(tp->rtk_enable_diag)) return -EBUSY; /* if autoneg is off, it's an error */ - rtl8125_mdio_write(tp, 0x1F, 0x0000); - bmcr = rtl8125_mdio_read(tp, MII_BMCR); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + bmcr = rtl8126_mdio_read(tp, MII_BMCR); if (bmcr & BMCR_ANENABLE) { bmcr |= BMCR_ANRESTART; - rtl8125_mdio_write(tp, MII_BMCR, bmcr); + rtl8126_mdio_write(tp, MII_BMCR, bmcr); ret = 0; } else { ret = -EINVAL; @@ -7012,7 +6891,7 @@ 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) +rtl8126_device_lpi_t_to_ethtool_lpi_t(struct rtl8126_private *tp , u32 lpi_timer) { u32 to_us; u16 status; @@ -7052,7 +6931,7 @@ rtl8125_device_lpi_t_to_ethtool_lpi_t(struct rtl8125_private *tp , u32 lpi_timer static int rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) { - struct rtl8125_private *tp = netdev_priv(net); + struct rtl8126_private *tp = netdev_priv(net); struct ethtool_eee *eee = &tp->eee; u32 lp, adv, tx_lpi_timer, supported = 0; u16 val; @@ -7061,7 +6940,7 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) return -EBUSY; /* Get Supported EEE */ - //val = mdio_direct_read_phy_ocp(tp, 0xA5C4); + //val = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5C4); //supported = mmd_eee_cap_to_ethtool_sup_t(val); supported = eee->supported; @@ -7069,16 +6948,16 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) adv = eee->advertised; /* Get LP advertisement EEE */ - val = mdio_direct_read_phy_ocp(tp, 0xA5D2); + val = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D2); lp = mmd_eee_adv_to_ethtool_adv_t(val); - val = mdio_direct_read_phy_ocp(tp, 0xA6D0); + val = rtl8126_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 = rtl8126_device_lpi_t_to_ethtool_lpi_t(tp, eee->tx_lpi_timer); - val = rtl8125_mac_ocp_read(tp, 0xE040); + val = rtl8126_mac_ocp_read(tp, 0xE040); val &= BIT_1 | BIT_0; edata->eee_enabled = !!val; @@ -7095,7 +6974,7 @@ rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) static int rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) { - struct rtl8125_private *tp = netdev_priv(net); + struct rtl8126_private *tp = netdev_priv(net); struct ethtool_eee *eee = &tp->eee; u32 advertising; int rc = 0; @@ -7157,9 +7036,9 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) eee->eee_enabled = edata->eee_enabled; if (eee->eee_enabled) - rtl8125_enable_eee(tp); + rtl8126_enable_eee(tp); else - rtl8125_disable_eee(tp); + rtl8126_disable_eee(tp); rtl_nway_reset(net); @@ -7172,32 +7051,32 @@ out: #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -static const struct ethtool_ops rtl8125_ethtool_ops = { - .get_drvinfo = rtl8125_get_drvinfo, - .get_regs_len = rtl8125_get_regs_len, +static const struct ethtool_ops rtl8126_ethtool_ops = { + .get_drvinfo = rtl8126_get_drvinfo, + .get_regs_len = rtl8126_get_regs_len, .get_link = ethtool_op_get_link, #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .get_ringparam = rtl8125_get_ringparam, - .set_ringparam = rtl8125_set_ringparam, + .get_ringparam = rtl8126_get_ringparam, + .set_ringparam = rtl8126_set_ringparam, #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) - .get_settings = rtl8125_get_settings, - .set_settings = rtl8125_set_settings, + .get_settings = rtl8126_get_settings, + .set_settings = rtl8126_set_settings, #else - .get_link_ksettings = rtl8125_get_settings, - .set_link_ksettings = rtl8125_set_settings, + .get_link_ksettings = rtl8126_get_settings, + .set_link_ksettings = rtl8126_set_settings, #endif //LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .get_pauseparam = rtl8125_get_pauseparam, - .set_pauseparam = rtl8125_set_pauseparam, + .get_pauseparam = rtl8126_get_pauseparam, + .set_pauseparam = rtl8126_set_pauseparam, #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .get_msglevel = rtl8125_get_msglevel, - .set_msglevel = rtl8125_set_msglevel, + .get_msglevel = rtl8126_get_msglevel, + .set_msglevel = rtl8126_set_msglevel, #if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) - .get_rx_csum = rtl8125_get_rx_csum, - .set_rx_csum = rtl8125_set_rx_csum, - .get_tx_csum = rtl8125_get_tx_csum, - .set_tx_csum = rtl8125_set_tx_csum, + .get_rx_csum = rtl8126_get_rx_csum, + .set_rx_csum = rtl8126_set_rx_csum, + .get_tx_csum = rtl8126_get_tx_csum, + .set_tx_csum = rtl8126_set_tx_csum, .get_sg = ethtool_op_get_sg, .set_sg = ethtool_op_set_sg, #ifdef NETIF_F_TSO @@ -7205,16 +7084,16 @@ static const struct ethtool_ops rtl8125_ethtool_ops = { .set_tso = ethtool_op_set_tso, #endif //NETIF_F_TSO #endif //LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) - .get_regs = rtl8125_get_regs, - .get_wol = rtl8125_get_wol, - .set_wol = rtl8125_set_wol, - .get_strings = rtl8125_get_strings, + .get_regs = rtl8126_get_regs, + .get_wol = rtl8126_get_wol, + .set_wol = rtl8126_set_wol, + .get_strings = rtl8126_get_strings, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) - .get_stats_count = rtl8125_get_stats_count, + .get_stats_count = rtl8126_get_stats_count, #else - .get_sset_count = rtl8125_get_sset_count, + .get_sset_count = rtl8126_get_sset_count, #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33) - .get_ethtool_stats = rtl8125_get_ethtool_stats, + .get_ethtool_stats = rtl8126_get_ethtool_stats, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) #ifdef ETHTOOL_GPERMADDR .get_perm_addr = ethtool_op_get_perm_addr, @@ -7223,16 +7102,16 @@ static const struct ethtool_ops rtl8125_ethtool_ops = { .get_eeprom = rtl_get_eeprom, .get_eeprom_len = rtl_get_eeprom_len, #ifdef ENABLE_RSS_SUPPORT - .get_rxnfc = rtl8125_get_rxnfc, - .set_rxnfc = rtl8125_set_rxnfc, - .get_rxfh_indir_size = rtl8125_rss_indir_size, - .get_rxfh_key_size = rtl8125_get_rxfh_key_size, - .get_rxfh = rtl8125_get_rxfh, - .set_rxfh = rtl8125_set_rxfh, + .get_rxnfc = rtl8126_get_rxnfc, + .set_rxnfc = rtl8126_set_rxnfc, + .get_rxfh_indir_size = rtl8126_rss_indir_size, + .get_rxfh_key_size = rtl8126_get_rxfh_key_size, + .get_rxfh = rtl8126_get_rxfh, + .set_rxfh = rtl8126_set_rxfh, #endif //ENABLE_RSS_SUPPORT #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) #ifdef ENABLE_PTP_SUPPORT - .get_ts_info = rtl8125_get_ts_info, + .get_ts_info = rtl8126_get_ts_info, #else .get_ts_info = ethtool_op_get_ts_info, #endif //ENABLE_PTP_SUPPORT @@ -7246,106 +7125,25 @@ static const struct ethtool_ops rtl8125_ethtool_ops = { }; #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) -#if 0 - -static int rtl8125_enable_green_feature(struct rtl8125_private *tp) -{ - u16 gphy_val; - - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8011); - rtl8125_set_eth_phy_ocp_bit(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: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8011); - rtl8125_clear_eth_phy_ocp_bit(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) +static void rtl8126_get_mac_version(struct rtl8126_private *tp) { u32 reg,val32; u32 ICVerID; - struct pci_dev *pdev = tp->pci_dev; val32 = RTL_R32(tp, TxConfig); reg = val32 & 0x7c800000; ICVerID = val32 & 0x00700000; switch (reg) { - case 0x60800000: - if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_2; - } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_3; - } else { - tp->mcfg = CFG_METHOD_3; - tp->HwIcVerUnknown = TRUE; - } - - tp->efuse_ver = EFUSE_SUPPORT_V4; - break; - case 0x64000000: - if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_4; - } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_5; - } else { - tp->mcfg = CFG_METHOD_5; - tp->HwIcVerUnknown = TRUE; - } - - tp->efuse_ver = EFUSE_SUPPORT_V4; - break; case 0x64800000: if (ICVerID == 0x00000000) { - tp->mcfg = CFG_METHOD_8; + tp->mcfg = CFG_METHOD_1; } else if (ICVerID == 0x100000) { - tp->mcfg = CFG_METHOD_9; + tp->mcfg = CFG_METHOD_2; } else if (ICVerID == 0x200000) { - tp->mcfg = CFG_METHOD_10; + tp->mcfg = CFG_METHOD_3; } else { - tp->mcfg = CFG_METHOD_10; + tp->mcfg = CFG_METHOD_3; tp->HwIcVerUnknown = TRUE; } @@ -7358,17 +7156,10 @@ static void rtl8125_get_mac_version(struct rtl8125_private *tp) tp->efuse_ver = EFUSE_NOT_SUPPORT; break; } - - if (pdev->device == 0x8162) { - if (tp->mcfg == CFG_METHOD_3) - tp->mcfg = CFG_METHOD_6; - else if (tp->mcfg == CFG_METHOD_5) - tp->mcfg = CFG_METHOD_7; - } } static void -rtl8125_print_mac_version(struct rtl8125_private *tp) +rtl8126_print_mac_version(struct rtl8126_private *tp) { int i; for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { @@ -7383,7 +7174,7 @@ rtl8125_print_mac_version(struct rtl8125_private *tp) } static void -rtl8125_tally_counter_addr_fill(struct rtl8125_private *tp) +rtl8126_tally_counter_addr_fill(struct rtl8126_private *tp) { if (!tp->tally_paddr) return; @@ -7393,7 +7184,7 @@ rtl8125_tally_counter_addr_fill(struct rtl8125_private *tp) } static void -rtl8125_tally_counter_clear(struct rtl8125_private *tp) +rtl8126_tally_counter_clear(struct rtl8126_private *tp) { if (!tp->tally_paddr) return; @@ -7403,463 +7194,262 @@ rtl8125_tally_counter_clear(struct rtl8125_private *tp) } static void -rtl8125_clear_phy_ups_reg(struct net_device *dev) +rtl8126_clear_phy_ups_reg(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); 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: - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA466, BIT_0); + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA466, BIT_0); break; }; - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA468, BIT_3 | BIT_1); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA468, BIT_3 | BIT_1); } static int -rtl8125_is_ups_resume(struct net_device *dev) +rtl8126_is_ups_resume(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) - return (rtl8125_mac_ocp_read(tp, 0xD42C) & BIT_8); - - return 0; + switch (tp->mcfg) { + case CFG_METHOD_1 ... CFG_METHOD_3: + return (rtl8126_mac_ocp_read(tp, 0xD42C) & BIT_8); + default: + return 0; + }; } static void -rtl8125_clear_ups_resume_bit(struct net_device *dev) +rtl8126_clear_ups_resume_bit(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) - rtl8125_mac_ocp_write(tp, 0xD42C, rtl8125_mac_ocp_read(tp, 0xD42C) & ~(BIT_8)); + switch (tp->mcfg) { + case CFG_METHOD_1 ... CFG_METHOD_3: + rtl8126_clear_mac_ocp_bit(tp, 0xD42C, BIT_8); + break; + default: + return; + }; +} + +static u8 +rtl8126_get_phy_state(struct rtl8126_private *tp) +{ + switch (tp->mcfg) { + case CFG_METHOD_1 ... CFG_METHOD_3: + return (rtl8126_mdio_direct_read_phy_ocp(tp, 0xA420) & 0x7); + default: + return 0xff; + }; } static void -rtl8125_wait_phy_ups_resume(struct net_device *dev, u16 PhyState) +rtl8126_wait_phy_ups_resume(struct net_device *dev, u16 PhyState) { - struct rtl8125_private *tp = netdev_priv(dev); - u16 TmpPhyState; - int i=0; + struct rtl8126_private *tp = netdev_priv(dev); + int i; - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) { - do { - TmpPhyState = mdio_direct_read_phy_ocp(tp, 0xA420); - TmpPhyState &= 0x7; - mdelay(1); - i++; - } while ((i < 100) && (TmpPhyState != PhyState)); - } + switch (tp->mcfg) { + case CFG_METHOD_1 ... CFG_METHOD_3: + for (i=0; i< 100; i++) { + if (rtl8126_get_phy_state(tp) == PhyState) + break; + else + mdelay(1); + } #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) +rtl8126_enable_now_is_oob(struct rtl8126_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) +rtl8126_disable_now_is_oob(struct rtl8126_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 -rtl8125_exit_oob(struct net_device *dev) +rtl8126_exit_oob(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 data16; - rtl8125_disable_rx_packet_filter(tp); + rtl8126_disable_rx_packet_filter(tp); if (HW_DASH_SUPPORT_DASH(tp)) { - rtl8125_driver_start(tp); - rtl8125_dash2_disable_txrx(dev); + rtl8126_driver_start(tp); + rtl8126_dash2_disable_txrx(dev); #ifdef ENABLE_DASH_SUPPORT DashHwInit(dev); #endif } #ifdef ENABLE_REALWOW_SUPPORT - rtl8125_realwow_hw_init(dev); + rtl8126_realwow_hw_init(dev); #else //Disable realwow function switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xC0BC, 0x00FF); + rtl8126_mac_ocp_write(tp, 0xC0BC, 0x00FF); break; } #endif //ENABLE_REALWOW_SUPPORT - rtl8125_nic_reset(dev); + rtl8126_nic_reset(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_disable_now_is_oob(tp); + rtl8126_disable_now_is_oob(tp); - data16 = rtl8125_mac_ocp_read(tp, 0xE8DE) & ~BIT_14; - rtl8125_mac_ocp_write(tp, 0xE8DE, data16); - rtl8125_wait_ll_share_fifo_ready(dev); + data16 = rtl8126_mac_ocp_read(tp, 0xE8DE) & ~BIT_14; + rtl8126_mac_ocp_write(tp, 0xE8DE, data16); + rtl8126_wait_ll_share_fifo_ready(dev); - rtl8125_mac_ocp_write(tp, 0xC0AA, 0x07D0); + rtl8126_mac_ocp_write(tp, 0xC0AA, 0x07D0); #ifdef ENABLE_LIB_SUPPORT - rtl8125_mac_ocp_write(tp, 0xC0A6, 0x04E2); + rtl8126_mac_ocp_write(tp, 0xC0A6, 0x04E2); #else - rtl8125_mac_ocp_write(tp, 0xC0A6, 0x01B5); + rtl8126_mac_ocp_write(tp, 0xC0A6, 0x01B5); #endif - rtl8125_mac_ocp_write(tp, 0xC01E, 0x5555); + rtl8126_mac_ocp_write(tp, 0xC01E, 0x5555); - rtl8125_wait_ll_share_fifo_ready(dev); + rtl8126_wait_ll_share_fifo_ready(dev); break; } //wait ups resume (phy state 2) switch (tp->mcfg) { + case CFG_METHOD_1: 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: - if (rtl8125_is_ups_resume(dev)) { - rtl8125_wait_phy_ups_resume(dev, 2); - rtl8125_clear_ups_resume_bit(dev); - rtl8125_clear_phy_ups_reg(dev); + if (rtl8126_is_ups_resume(dev)) { + rtl8126_wait_phy_ups_resume(dev, 2); + rtl8126_clear_ups_resume_bit(dev); + rtl8126_clear_phy_ups_reg(dev); } break; }; } void -rtl8125_hw_disable_mac_mcu_bps(struct net_device *dev) +rtl8126_hw_disable_mac_mcu_bps(struct net_device *dev) { u16 regAddr; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_enable_aspm_clkreq_lock(tp, 0); + rtl8126_enable_aspm_clkreq_lock(tp, 0); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xFC48, 0x0000); + rtl8126_mac_ocp_write(tp, 0xFC48, 0x0000); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: for (regAddr = 0xFC28; regAddr < 0xFC48; regAddr += 2) { - rtl8125_mac_ocp_write(tp, regAddr, 0x0000); + rtl8126_mac_ocp_write(tp, regAddr, 0x0000); } mdelay(3); - rtl8125_mac_ocp_write(tp, 0xFC26, 0x0000); + rtl8126_mac_ocp_write(tp, 0xFC26, 0x0000); break; } } #ifndef ENABLE_USE_FIRMWARE_FILE static void -rtl8125_switch_mac_mcu_ram_code_page(struct rtl8125_private *tp, u16 page) +rtl8126_switch_mac_mcu_ram_code_page(struct rtl8126_private *tp, u16 page) { u16 tmpUshort; page &= (BIT_1 | BIT_0); - tmpUshort = rtl8125_mac_ocp_read(tp, 0xE446); + tmpUshort = rtl8126_mac_ocp_read(tp, 0xE446); tmpUshort &= ~(BIT_1 | BIT_0); tmpUshort |= page; - rtl8125_mac_ocp_write(tp, 0xE446, tmpUshort); + rtl8126_mac_ocp_write(tp, 0xE446, tmpUshort); } static void -_rtl8125_write_mac_mcu_ram_code(struct rtl8125_private *tp, const u16 *entry, u16 entry_cnt) +_rtl8126_write_mac_mcu_ram_code(struct rtl8126_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]); + rtl8126_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) +_rtl8126_write_mac_mcu_ram_code_with_page(struct rtl8126_private *tp, const u16 *entry, u16 entry_cnt, u16 page_size) { u16 i; u16 offset; - if (page_size == 0) return; + 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); + rtl8126_switch_mac_mcu_ram_code_page(tp, page); } - rtl8125_mac_ocp_write(tp, 0xF800 + offset * 2, entry[i]); + rtl8126_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) +rtl8126_write_mac_mcu_ram_code(struct rtl8126_private *tp, const u16 *entry, u16 entry_cnt) { - if (FALSE == HW_SUPPORT_MAC_MCU(tp)) return; - if (entry == NULL || entry_cnt == 0) return; + 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); + _rtl8126_write_mac_mcu_ram_code_with_page(tp, entry, entry_cnt, tp->MacMcuPageSize); else - _rtl8125_write_mac_mcu_ram_code(tp, entry, entry_cnt); + _rtl8126_write_mac_mcu_ram_code(tp, entry, entry_cnt); } static void -rtl8125_set_mac_mcu_8125a_1(struct net_device *dev) +rtl8126_set_mac_mcu_8126a_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_8126a_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); static const u16 mcu_patch_code_8126a_1[] = { 0xE010, 0xE019, 0xE01B, 0xE01D, 0xE01F, 0xE021, 0xE023, 0xE025, 0xE027, 0xE029, 0xE02B, 0xE02D, 0xE02F, 0xE031, 0xE033, 0xE035, 0x48C0, 0x9C66, @@ -7871,79 +7461,66 @@ rtl8125_set_mac_mcu_8126a_1(struct net_device *dev) 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000 }; - rtl8125_hw_disable_mac_mcu_bps(dev); + rtl8126_hw_disable_mac_mcu_bps(dev); - rtl8125_write_mac_mcu_ram_code(tp, mcu_patch_code_8126a_1, ARRAY_SIZE(mcu_patch_code_8126a_1)); + rtl8126_write_mac_mcu_ram_code(tp, mcu_patch_code_8126a_1, ARRAY_SIZE(mcu_patch_code_8126a_1)); - rtl8125_mac_ocp_write(tp, 0xFC26, 0x8000); + rtl8126_mac_ocp_write(tp, 0xFC26, 0x8000); - rtl8125_mac_ocp_write(tp, 0xFC28, 0x0AAA); + rtl8126_mac_ocp_write(tp, 0xFC28, 0x0AAA); - rtl8125_mac_ocp_write(tp, 0xFC48, 0x0001); + rtl8126_mac_ocp_write(tp, 0xFC48, 0x0001); } static void -rtl8125_set_mac_mcu_8126a_2(struct net_device *dev) +rtl8126_set_mac_mcu_8126a_2(struct net_device *dev) { - rtl8125_hw_disable_mac_mcu_bps(dev); + rtl8126_hw_disable_mac_mcu_bps(dev); } static void -rtl8125_set_mac_mcu_8126a_3(struct net_device *dev) +rtl8126_set_mac_mcu_8126a_3(struct net_device *dev) { - rtl8125_hw_disable_mac_mcu_bps(dev); + rtl8126_hw_disable_mac_mcu_bps(dev); } static void -rtl8125_hw_mac_mcu_config(struct net_device *dev) +rtl8126_hw_mac_mcu_config(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (tp->NotWrMcuPatchCode == TRUE) return; + if (tp->NotWrMcuPatchCode == TRUE) + return; switch (tp->mcfg) { + case CFG_METHOD_1: + rtl8126_set_mac_mcu_8126a_1(dev); + break; case CFG_METHOD_2: - rtl8125_set_mac_mcu_8125a_1(dev); + rtl8126_set_mac_mcu_8126a_2(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_8126a_1(dev); - break; - case CFG_METHOD_9: - rtl8125_set_mac_mcu_8126a_2(dev); - break; - case CFG_METHOD_10: - rtl8125_set_mac_mcu_8126a_3(dev); + rtl8126_set_mac_mcu_8126a_3(dev); break; } } #endif #ifdef ENABLE_USE_FIRMWARE_FILE -static void rtl8125_release_firmware(struct rtl8125_private *tp) +static void rtl8126_release_firmware(struct rtl8126_private *tp) { if (tp->rtl_fw) { - rtl8125_fw_release_firmware(tp->rtl_fw); + rtl8126_fw_release_firmware(tp->rtl_fw); kfree(tp->rtl_fw); tp->rtl_fw = NULL; } } -void rtl8125_apply_firmware(struct rtl8125_private *tp) +void rtl8126_apply_firmware(struct rtl8126_private *tp) { /* TODO: release firmware if rtl_fw_write_firmware signals failure. */ if (tp->rtl_fw) { - rtl8125_fw_write_firmware(tp, tp->rtl_fw); + rtl8126_fw_write_firmware(tp, tp->rtl_fw); /* At least one firmware doesn't reset tp->ocp_base. */ tp->ocp_base = OCP_STD_PHY_BASE; @@ -7951,9 +7528,9 @@ void rtl8125_apply_firmware(struct rtl8125_private *tp) //phy_read_poll_timeout(tp->phydev, MII_BMCR, val, // !(val & BMCR_RESET), // 50000, 600000, true); - rtl8125_wait_phy_reset_complete(tp); + rtl8126_wait_phy_reset_complete(tp); - tp->hw_ram_code_ver = rtl8125_get_hw_phy_mcu_code_ver(tp); + tp->hw_ram_code_ver = rtl8126_get_hw_phy_mcu_code_ver(tp); tp->sw_ram_code_ver = tp->hw_ram_code_ver; tp->HwHasWrRamCodeToMicroP = TRUE; } @@ -7961,219 +7538,82 @@ void rtl8125_apply_firmware(struct rtl8125_private *tp) #endif static void -rtl8125_hw_init(struct net_device *dev) +rtl8126_hw_init(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u32 csi_tmp; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_enable_aspm_clkreq_lock(tp, 0); - rtl8125_enable_force_clkreq(tp, 0); + rtl8126_enable_aspm_clkreq_lock(tp, 0); + rtl8126_enable_force_clkreq(tp, 0); break; } //Disable UPS switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xD40A, rtl8125_mac_ocp_read( tp, 0xD40A) & ~(BIT_4)); + rtl8126_mac_ocp_write(tp, 0xD40A, rtl8126_mac_ocp_read(tp, 0xD40A) & ~(BIT_4)); break; } #ifndef ENABLE_USE_FIRMWARE_FILE if (!tp->rtl_fw) - rtl8125_hw_mac_mcu_config(dev); + rtl8126_hw_mac_mcu_config(dev); #endif - /*disable ocp phy power saving*/ - if (tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) - rtl8125_disable_ocp_phy_power_saving(dev); - //Set PCIE uncorrectable error status mask pcie 0x108 - csi_tmp = rtl8125_csi_read(tp, 0x108); + csi_tmp = rtl8126_csi_read(tp, 0x108); csi_tmp |= BIT_20; - rtl8125_csi_write(tp, 0x108, csi_tmp); + rtl8126_csi_write(tp, 0x108, csi_tmp); - rtl8125_enable_cfg9346_write(tp); - rtl8125_disable_linkchg_wakeup(dev); - rtl8125_disable_cfg9346_write(tp); - rtl8125_disable_magic_packet(dev); - rtl8125_disable_d0_speedup(tp); - rtl8125_set_pci_pme(tp, 0); + rtl8126_enable_cfg9346_write(tp); + rtl8126_disable_linkchg_wakeup(dev); + rtl8126_disable_cfg9346_write(tp); + rtl8126_disable_magic_packet(dev); + rtl8126_disable_d0_speedup(tp); + rtl8126_set_pci_pme(tp, 0); if (s0_magic_packet == 1) - rtl8125_enable_magic_packet(dev); + rtl8126_enable_magic_packet(dev); #ifdef ENABLE_USE_FIRMWARE_FILE if (tp->rtl_fw && !tp->resume_not_chg_speed && !(HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06)) - rtl8125_apply_firmware(tp); + rtl8126_apply_firmware(tp); #endif } static void -rtl8125_hw_ephy_config(struct net_device *dev) +rtl8126_hw_ephy_config(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: case CFG_METHOD_2: - rtl8125_ephy_write(tp, 0x01, 0xA812); - rtl8125_ephy_write(tp, 0x09, 0x520C); - rtl8125_ephy_write(tp, 0x04, 0xD000); - rtl8125_ephy_write(tp, 0x0D, 0xF702); - rtl8125_ephy_write(tp, 0x0A, 0x8653); - rtl8125_ephy_write(tp, 0x06, 0x001E); - rtl8125_ephy_write(tp, 0x08, 0x3595); - rtl8125_ephy_write(tp, 0x20, 0x9455); - rtl8125_ephy_write(tp, 0x21, 0x99FF); - rtl8125_ephy_write(tp, 0x02, 0x6046); - rtl8125_ephy_write(tp, 0x29, 0xFE00); - rtl8125_ephy_write(tp, 0x23, 0xAB62); - - rtl8125_ephy_write(tp, 0x41, 0xA80C); - rtl8125_ephy_write(tp, 0x49, 0x520C); - rtl8125_ephy_write(tp, 0x44, 0xD000); - rtl8125_ephy_write(tp, 0x4D, 0xF702); - rtl8125_ephy_write(tp, 0x4A, 0x8653); - rtl8125_ephy_write(tp, 0x46, 0x001E); - rtl8125_ephy_write(tp, 0x48, 0x3595); - rtl8125_ephy_write(tp, 0x60, 0x9455); - rtl8125_ephy_write(tp, 0x61, 0x99FF); - rtl8125_ephy_write(tp, 0x42, 0x6046); - rtl8125_ephy_write(tp, 0x69, 0xFE00); - rtl8125_ephy_write(tp, 0x63, 0xAB62); - break; case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_ephy_write(tp, 0x04, 0xD000); - rtl8125_ephy_write(tp, 0x0A, 0x8653); - rtl8125_ephy_write(tp, 0x23, 0xAB66); - rtl8125_ephy_write(tp, 0x20, 0x9455); - rtl8125_ephy_write(tp, 0x21, 0x99FF); - rtl8125_ephy_write(tp, 0x29, 0xFE04); - - rtl8125_ephy_write(tp, 0x44, 0xD000); - rtl8125_ephy_write(tp, 0x4A, 0x8653); - rtl8125_ephy_write(tp, 0x63, 0xAB66); - rtl8125_ephy_write(tp, 0x60, 0x9455); - rtl8125_ephy_write(tp, 0x61, 0x99FF); - rtl8125_ephy_write(tp, 0x69, 0xFE04); - - ClearAndSetPCIePhyBit(tp, - 0x2A, - (BIT_14 | BIT_13 | BIT_12), - (BIT_13 | BIT_12) - ); - ClearPCIePhyBit(tp, 0x19, BIT_6); - SetPCIePhyBit(tp, 0x1B, (BIT_11 | BIT_10 | BIT_9)); - ClearPCIePhyBit(tp, 0x1B, (BIT_14 | BIT_13 | BIT_12)); - rtl8125_ephy_write(tp, 0x02, 0x6042); - rtl8125_ephy_write(tp, 0x06, 0x0014); - - ClearAndSetPCIePhyBit(tp, - 0x6A, - (BIT_14 | BIT_13 | BIT_12), - (BIT_13 | BIT_12) - ); - ClearPCIePhyBit(tp, 0x59, BIT_6); - SetPCIePhyBit(tp, 0x5B, (BIT_11 | BIT_10 | BIT_9)); - ClearPCIePhyBit(tp, 0x5B, (BIT_14 | BIT_13 | BIT_12)); - rtl8125_ephy_write(tp, 0x42, 0x6042); - rtl8125_ephy_write(tp, 0x46, 0x0014); - break; - case CFG_METHOD_4: - rtl8125_ephy_write(tp, 0x06, 0x001F); - rtl8125_ephy_write(tp, 0x0A, 0xB66B); - rtl8125_ephy_write(tp, 0x01, 0xA852); - rtl8125_ephy_write(tp, 0x24, 0x0008); - rtl8125_ephy_write(tp, 0x2F, 0x6052); - rtl8125_ephy_write(tp, 0x0D, 0xF716); - rtl8125_ephy_write(tp, 0x20, 0xD477); - rtl8125_ephy_write(tp, 0x21, 0x4477); - rtl8125_ephy_write(tp, 0x22, 0x0013); - rtl8125_ephy_write(tp, 0x23, 0xBB66); - rtl8125_ephy_write(tp, 0x0B, 0xA909); - rtl8125_ephy_write(tp, 0x29, 0xFF04); - rtl8125_ephy_write(tp, 0x1B, 0x1EA0); - - rtl8125_ephy_write(tp, 0x46, 0x001F); - rtl8125_ephy_write(tp, 0x4A, 0xB66B); - rtl8125_ephy_write(tp, 0x41, 0xA84A); - rtl8125_ephy_write(tp, 0x64, 0x000C); - rtl8125_ephy_write(tp, 0x6F, 0x604A); - rtl8125_ephy_write(tp, 0x4D, 0xF716); - rtl8125_ephy_write(tp, 0x60, 0xD477); - rtl8125_ephy_write(tp, 0x61, 0x4477); - rtl8125_ephy_write(tp, 0x62, 0x0013); - rtl8125_ephy_write(tp, 0x63, 0xBB66); - rtl8125_ephy_write(tp, 0x4B, 0xA909); - rtl8125_ephy_write(tp, 0x69, 0xFF04); - rtl8125_ephy_write(tp, 0x5B, 0x1EA0); - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_ephy_write(tp, 0x0B, 0xA908); - rtl8125_ephy_write(tp, 0x1E, 0x20EB); - rtl8125_ephy_write(tp, 0x22, 0x0023); - rtl8125_ephy_write(tp, 0x02, 0x60C2); - rtl8125_ephy_write(tp, 0x29, 0xFF00); - - rtl8125_ephy_write(tp, 0x4B, 0xA908); - rtl8125_ephy_write(tp, 0x5E, 0x28EB); - rtl8125_ephy_write(tp, 0x62, 0x0023); - rtl8125_ephy_write(tp, 0x42, 0x60C2); - rtl8125_ephy_write(tp, 0x69, 0xFF00); - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: + /* nothing to do */ break; } } static u16 -rtl8125_get_hw_phy_mcu_code_ver(struct rtl8125_private *tp) +rtl8126_get_hw_phy_mcu_code_ver(struct rtl8126_private *tp) { u16 hw_ram_code_ver = ~0; switch (tp->mcfg) { + case CFG_METHOD_1: 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: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); - hw_ram_code_ver = mdio_direct_read_phy_ocp(tp, 0xA438); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); + hw_ram_code_ver = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA438); break; } @@ -8181,12 +7621,12 @@ rtl8125_get_hw_phy_mcu_code_ver(struct rtl8125_private *tp) } static int -rtl8125_check_hw_phy_mcu_code_ver(struct net_device *dev) +rtl8126_check_hw_phy_mcu_code_ver(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ram_code_ver_match = 0; - tp->hw_ram_code_ver = rtl8125_get_hw_phy_mcu_code_ver(tp); + tp->hw_ram_code_ver = rtl8126_get_hw_phy_mcu_code_ver(tp); if (tp->hw_ram_code_ver == tp->sw_ram_code_ver) { ram_code_ver_match = 1; @@ -8197,130 +7637,76 @@ rtl8125_check_hw_phy_mcu_code_ver(struct net_device *dev) } bool -rtl8125_set_phy_mcu_patch_request(struct rtl8125_private *tp) +rtl8126_set_phy_mcu_patch_request(struct rtl8126_private *tp) { u16 gphy_val; u16 WaitCount; bool bSuccess = TRUE; - rtl8125_set_eth_phy_ocp_bit(tp, 0xB820, BIT_4); + rtl8126_set_eth_phy_ocp_bit(tp, 0xB820, BIT_4); WaitCount = 0; do { - gphy_val = mdio_direct_read_phy_ocp(tp, 0xB800); + gphy_val = rtl8126_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"); + dprintk("rtl8126_set_phy_mcu_patch_request fail.\n"); return bSuccess; } bool -rtl8125_clear_phy_mcu_patch_request(struct rtl8125_private *tp) +rtl8126_clear_phy_mcu_patch_request(struct rtl8126_private *tp) { u16 gphy_val; u16 WaitCount; bool bSuccess = TRUE; - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB820, BIT_4); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xB820, BIT_4); WaitCount = 0; do { - gphy_val = mdio_direct_read_phy_ocp(tp, 0xB800); + gphy_val = rtl8126_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"); + dprintk("rtl8126_clear_phy_mcu_patch_request fail.\n"); return bSuccess; } #ifndef ENABLE_USE_FIRMWARE_FILE static void -rtl8125_write_hw_phy_mcu_code_ver(struct net_device *dev) +rtl8126_write_hw_phy_mcu_code_ver(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); - mdio_direct_write_phy_ocp(tp, 0xA438, tp->sw_ram_code_ver); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x801E); + rtl8126_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) +rtl8126_set_phy_mcu_ram_code(struct net_device *dev, const u16 *ramcode, u16 codesize) { - u16 PatchKey; - - switch (tp->mcfg) { - case CFG_METHOD_2: - PatchKey = 0x8600; - break; - case CFG_METHOD_3: - case CFG_METHOD_6: - PatchKey = 0x8601; - break; - case CFG_METHOD_4: - PatchKey = 0x3700; - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - PatchKey = 0x3701; - break; - default: - return; - } - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8024); - mdio_direct_write_phy_ocp(tp, 0xA438, PatchKey); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xB82E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0001); -} - -static void -rtl8125_release_phy_mcu_patch_key_lock(struct rtl8125_private *tp) -{ - switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - mdio_direct_write_phy_ocp(tp, 0xA436, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB82E, BIT_0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - break; - default: - break; - } -} - -static void -rtl8125_set_phy_mcu_ram_code(struct net_device *dev, const u16 *ramcode, u16 codesize) -{ - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); u16 i; u16 addr; u16 val; @@ -8335,7 +7721,7 @@ rtl8125_set_phy_mcu_ram_code(struct net_device *dev, const u16 *ramcode, u16 cod if (addr == 0xFFFF && val == 0xFFFF) { break; } - mdio_direct_write_phy_ocp(tp, addr, val); + rtl8126_mdio_direct_write_phy_ocp(tp, addr, val); } out: @@ -8343,9 +7729,9 @@ out: } static void -rtl8125_enable_phy_disable_mode(struct net_device *dev) +rtl8126_enable_phy_disable_mode(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->HwSuppCheckPhyDisableModeVer) { case 3: @@ -8357,9 +7743,9 @@ rtl8125_enable_phy_disable_mode(struct net_device *dev) } static void -rtl8125_disable_phy_disable_mode(struct net_device *dev) +rtl8126_disable_phy_disable_mode(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); switch (tp->HwSuppCheckPhyDisableModeVer) { case 3: @@ -8372,2343 +7758,6 @@ rtl8125_disable_phy_disable_mode(struct net_device *dev) dprintk("disable phy disable mode.\n"); } -static void -rtl8125_set_hw_phy_before_init_phy_mcu(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - u16 PhyRegValue; - - switch (tp->mcfg) { - case CFG_METHOD_4: - mdio_direct_write_phy_ocp(tp, 0xBF86, 0x9000); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xC402, BIT_10); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xC402, BIT_10); - - PhyRegValue = mdio_direct_read_phy_ocp(tp, 0xBF86); - PhyRegValue &= (BIT_1 | BIT_0); - if (PhyRegValue != 0) - dprintk("PHY watch dog not clear, value = 0x%x \n", PhyRegValue); - - mdio_direct_write_phy_ocp(tp, 0xBD86, 0x1010); - mdio_direct_write_phy_ocp(tp, 0xBD88, 0x1010); - - 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); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8013); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8021); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x802f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x803d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8042); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa088); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a50); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1a3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x401a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd707); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f8b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a6c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd019); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1a2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x401a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd707); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f8b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a84); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8970); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c07); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0901); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcf09); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd705); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xceff); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf0a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1213); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8401); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8580); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1253); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd064); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd181); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4018); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd706); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2c59); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x804d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc60f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc605); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10fd); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA026); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA022); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10f4); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA020); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1252); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA006); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1206); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA004); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a78); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a60); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a4f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3f00); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0010); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8066); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x807c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8089); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x808e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80b2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80c2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62db); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x655c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0505); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x653c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0506); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0505); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0506); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x050c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0508); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0304); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd73e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x614a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0508); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0321); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0346); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8208); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x609d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x001a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x001a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x607d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ab); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x017b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x017b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60fd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa50f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaa0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0231); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0503); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a05); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0231); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0221); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ce); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA088); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0169); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA086); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00a6); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA084); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x000d); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA082); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0308); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x029f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA090); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x007f); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0020); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8017); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8029); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8054); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x805a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8064); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9430); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9480); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb408); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd120); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd057); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb80); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9906); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0567); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb94); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8406); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8dff); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0773); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb91); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd139); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07dc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa2a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4045); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa180); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07ec); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07dc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fa7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0481); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x94bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x870c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa00a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa280); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8220); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x078e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb92); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd150); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6121); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x61a2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6223); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d20); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d30); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf005); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d40); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4046); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07f7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0742); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3ad4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0537); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa70c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x890c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x064b); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0642); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0686); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0788); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA108); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x047b); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA106); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x065c); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA104); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0769); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA102); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0565); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x06f9); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ff); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8530); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3caf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8593); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9caf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x85a5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5afb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe083); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfb0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x020d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x021b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86d7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbe0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x83fc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1b10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xda02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xdd02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5afb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe083); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfd0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x020d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x021b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86dd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbe0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x83fe); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1b10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf2f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2cac); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0286); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x65af); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x212b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x022c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86b6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf21); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cd1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8710); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x870d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8716); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x871f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x871c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8728); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8725); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8707); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbad); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x281c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1302); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2202); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2b02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae1a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd101); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1302); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2202); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2b02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd101); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3102); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3d02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3a02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4302); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4c02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4902); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2e02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4602); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf87); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4f02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ab7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf35); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7ff8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfaef); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x69bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e3); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86fb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86fe); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86e9); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86ec); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfbbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x025a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7bf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86ef); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cbf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x86f8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0262); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7cef); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x96fe); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfc04); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf8fa); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef69); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf202); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf502); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbf86); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf802); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6273); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef96); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfefc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0420); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb540); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x53b5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4086); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb540); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb9b5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40c8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb03a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbac8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb13a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xba77); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd26); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffbd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2677); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd28); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffbd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd26); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8bd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2640); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbd28); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc8bd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x28bb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa430); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x98b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1eba); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb01e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xdcb0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e98); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbab0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9edc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x98b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1eba); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb11e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xdcb1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e98); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbab1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9edc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e22); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb01e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x33b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e11); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x22b0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9e33); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb09e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e22); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb11e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x33b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1e11); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x22b1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9e33); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb19e); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb85e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2f71); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb860); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x20d9); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb862); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x2109); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb864); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x34e7); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb878); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x000f); - - - 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); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x808b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x808f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8093); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8097); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x809d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80aa); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x607b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x42da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x615b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14a4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x14bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f2e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf034); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac11); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa410); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4779); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf034); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac22); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa420); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4559); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf023); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac44); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa440); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4339); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd719); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4118); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac88); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa480); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xce00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4119); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xac0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1444); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf001); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1456); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd718); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fac); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc48f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x141b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd504); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x121a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1bb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0898); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1bb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a0e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd064); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd18a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0b7e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x401c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd501); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa804); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8804); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x053b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd500); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0648); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc520); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa201); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x252d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1646); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd708); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4006); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1646); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0308); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA026); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0307); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1645); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA022); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0647); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA020); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x053a); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA006); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0b7c); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA004); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0a0c); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0896); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11a1); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xff00); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0010); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8015); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x801a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xad02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x02d7); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ed); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0509); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xc100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x008f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA08A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA088); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA086); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA084); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA082); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x008d); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00eb); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA090); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0103); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA016); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0020); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA012); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8014); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8018); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8024); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8051); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8055); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8072); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x80dc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfffd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfffd); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa70c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x9402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x890c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8840); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa380); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb91); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd139); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd140); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa2a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4085); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa180); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8280); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07f0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5f74); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x82a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0c0f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd158); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd04d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03d4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x94bc); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x870c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8380); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd10d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fb4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa190); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa00a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa280); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa404); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa220); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd130); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5fb4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xbb80); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1c4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd074); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa301); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x604b); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa90c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0556); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xcb92); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4063); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd116); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd119); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd040); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x60a0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6241); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x63e2); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6583); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf054); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d10); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d50); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf02a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d20); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf021); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d60); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf01c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d30); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf013); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d70); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf00e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x611e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x40da); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d40); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf005); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d80); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x405d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa720); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd700); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x5ff4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa008); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd704); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4046); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa002); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07fb); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd703); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f6f); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f4e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f2d); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7f0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x800a); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0cf0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0d00); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07e8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8010); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa740); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0743); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x7fb5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd701); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3ad4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0556); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8610); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x066e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd1f5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xd049); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1800); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ec); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10E); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x01ea); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x06a9); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA10A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x078a); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA108); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03d2); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA106); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x067f); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA104); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0665); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA102); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA100); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xA110); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00fc); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8530); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb87e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3caf); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8545); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf85); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x45af); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8545); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xee82); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xf900); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0103); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xaf03); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb7f8); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0a6); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00e1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa601); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xef01); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x58f0); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa080); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x37a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8402); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae16); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa185); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x02ae); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x11a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8702); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae0c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xa188); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x02ae); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x07a1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x8902); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xae1c); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6901); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe4b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe0b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x6901); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xe4b4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x62e5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xb463); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xfc04); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb85e); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x03b3); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb860); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb862); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb864); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xffff); - mdio_direct_write_phy_ocp(tp, 0xA436, 0xb878); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0001); - - - 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, 0x889c, 0xa438, 0xaf88, - 0xa438, 0x9caf, 0xa438, 0x889c, 0xa438, 0xbf86, 0xa438, 0x49d7, - 0xa438, 0x0040, 0xa438, 0x0277, 0xa438, 0x7daf, 0xa438, 0x2727, - 0xa438, 0x0000, 0xa438, 0x7205, 0xa438, 0x0000, 0xa438, 0x7208, - 0xa438, 0x0000, 0xa438, 0x71f3, 0xa438, 0x0000, 0xa438, 0x71f6, - 0xa438, 0x0000, 0xa438, 0x7229, 0xa438, 0x0000, 0xa438, 0x722c, - 0xa438, 0x0000, 0xa438, 0x7217, 0xa438, 0x0000, 0xa438, 0x721a, - 0xa438, 0x0000, 0xa438, 0x721d, 0xa438, 0x0000, 0xa438, 0x7211, - 0xa438, 0x0000, 0xa438, 0x7220, 0xa438, 0x0000, 0xa438, 0x7214, - 0xa438, 0x0000, 0xa438, 0x722f, 0xa438, 0x0000, 0xa438, 0x7223, - 0xa438, 0x0000, 0xa438, 0x7232, 0xa438, 0x0000, 0xa438, 0x7226, - 0xa438, 0xf8f9, 0xa438, 0xfae0, 0xa438, 0x85b3, 0xa438, 0x3802, - 0xa438, 0xad27, 0xa438, 0x02ae, 0xa438, 0x03af, 0xa438, 0x8830, - 0xa438, 0x1f66, 0xa438, 0xef65, 0xa438, 0xbfc2, 0xa438, 0x1f1a, - 0xa438, 0x96f7, 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00da, - 0xa438, 0xf605, 0xa438, 0xbfc2, 0xa438, 0x2f1a, 0xa438, 0x96f7, - 0xa438, 0x05ee, 0xa438, 0xffd2, 0xa438, 0x00db, 0xa438, 0xf605, - 0xa438, 0xef02, 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, - 0xa438, 0x4202, 0xa438, 0x6e7d, 0xa438, 0xef02, 0xa438, 0x1b03, - 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4502, - 0xa438, 0x6e7d, 0xa438, 0xef02, 0xa438, 0x1a03, 0xa438, 0x1f11, - 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4802, 0xa438, 0x6e7d, - 0xa438, 0xbfc2, 0xa438, 0x3f1a, 0xa438, 0x96f7, 0xa438, 0x05ee, - 0xa438, 0xffd2, 0xa438, 0x00da, 0xa438, 0xf605, 0xa438, 0xbfc2, - 0xa438, 0x4f1a, 0xa438, 0x96f7, 0xa438, 0x05ee, 0xa438, 0xffd2, - 0xa438, 0x00db, 0xa438, 0xf605, 0xa438, 0xef02, 0xa438, 0x1f11, - 0xa438, 0x0d42, 0xa438, 0xbf88, 0xa438, 0x4b02, 0xa438, 0x6e7d, - 0xa438, 0xef02, 0xa438, 0x1b03, 0xa438, 0x1f11, 0xa438, 0x0d42, - 0xa438, 0xbf88, 0xa438, 0x4e02, 0xa438, 0x6e7d, 0xa438, 0xef02, - 0xa438, 0x1a03, 0xa438, 0x1f11, 0xa438, 0x0d42, 0xa438, 0xbf88, - 0xa438, 0x5102, 0xa438, 0x6e7d, 0xa438, 0xef56, 0xa438, 0xd020, - 0xa438, 0x1f11, 0xa438, 0xbf88, 0xa438, 0x5402, 0xa438, 0x6e7d, - 0xa438, 0xbf88, 0xa438, 0x5702, 0xa438, 0x6e7d, 0xa438, 0xbf88, - 0xa438, 0x5a02, 0xa438, 0x6e7d, 0xa438, 0xe185, 0xa438, 0xa0ef, - 0xa438, 0x0348, 0xa438, 0x0a28, 0xa438, 0x05ef, 0xa438, 0x201b, - 0xa438, 0x01ad, 0xa438, 0x2735, 0xa438, 0x1f44, 0xa438, 0xe085, - 0xa438, 0x88e1, 0xa438, 0x8589, 0xa438, 0xbf88, 0xa438, 0x5d02, - 0xa438, 0x6e7d, 0xa438, 0xe085, 0xa438, 0x8ee1, 0xa438, 0x858f, - 0xa438, 0xbf88, 0xa438, 0x6002, 0xa438, 0x6e7d, 0xa438, 0xe085, - 0xa438, 0x94e1, 0xa438, 0x8595, 0xa438, 0xbf88, 0xa438, 0x6302, - 0xa438, 0x6e7d, 0xa438, 0xe085, 0xa438, 0x9ae1, 0xa438, 0x859b, - 0xa438, 0xbf88, 0xa438, 0x6602, 0xa438, 0x6e7d, 0xa438, 0xaf88, - 0xa438, 0x3cbf, 0xa438, 0x883f, 0xa438, 0x026e, 0xa438, 0x9cad, - 0xa438, 0x2835, 0xa438, 0x1f44, 0xa438, 0xe08f, 0xa438, 0xf8e1, - 0xa438, 0x8ff9, 0xa438, 0xbf88, 0xa438, 0x5d02, 0xa438, 0x6e7d, - 0xa438, 0xe08f, 0xa438, 0xfae1, 0xa438, 0x8ffb, 0xa438, 0xbf88, - 0xa438, 0x6002, 0xa438, 0x6e7d, 0xa438, 0xe08f, 0xa438, 0xfce1, - 0xa438, 0x8ffd, 0xa438, 0xbf88, 0xa438, 0x6302, 0xa438, 0x6e7d, - 0xa438, 0xe08f, 0xa438, 0xfee1, 0xa438, 0x8fff, 0xa438, 0xbf88, - 0xa438, 0x6602, 0xa438, 0x6e7d, 0xa438, 0xaf88, 0xa438, 0x3ce1, - 0xa438, 0x85a1, 0xa438, 0x1b21, 0xa438, 0xad37, 0xa438, 0x341f, - 0xa438, 0x44e0, 0xa438, 0x858a, 0xa438, 0xe185, 0xa438, 0x8bbf, - 0xa438, 0x885d, 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x8590, - 0xa438, 0xe185, 0xa438, 0x91bf, 0xa438, 0x8860, 0xa438, 0x026e, - 0xa438, 0x7de0, 0xa438, 0x8596, 0xa438, 0xe185, 0xa438, 0x97bf, - 0xa438, 0x8863, 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x859c, - 0xa438, 0xe185, 0xa438, 0x9dbf, 0xa438, 0x8866, 0xa438, 0x026e, - 0xa438, 0x7dae, 0xa438, 0x401f, 0xa438, 0x44e0, 0xa438, 0x858c, - 0xa438, 0xe185, 0xa438, 0x8dbf, 0xa438, 0x885d, 0xa438, 0x026e, - 0xa438, 0x7de0, 0xa438, 0x8592, 0xa438, 0xe185, 0xa438, 0x93bf, - 0xa438, 0x8860, 0xa438, 0x026e, 0xa438, 0x7de0, 0xa438, 0x8598, - 0xa438, 0xe185, 0xa438, 0x99bf, 0xa438, 0x8863, 0xa438, 0x026e, - 0xa438, 0x7de0, 0xa438, 0x859e, 0xa438, 0xe185, 0xa438, 0x9fbf, - 0xa438, 0x8866, 0xa438, 0x026e, 0xa438, 0x7dae, 0xa438, 0x0ce1, - 0xa438, 0x85b3, 0xa438, 0x3904, 0xa438, 0xac2f, 0xa438, 0x04ee, - 0xa438, 0x85b3, 0xa438, 0x00af, 0xa438, 0x39d9, 0xa438, 0x22ac, - 0xa438, 0xeaf0, 0xa438, 0xacf6, 0xa438, 0xf0ac, 0xa438, 0xfaf0, - 0xa438, 0xacf8, 0xa438, 0xf0ac, 0xa438, 0xfcf0, 0xa438, 0xad00, - 0xa438, 0xf0ac, 0xa438, 0xfef0, 0xa438, 0xacf0, 0xa438, 0xf0ac, - 0xa438, 0xf4f0, 0xa438, 0xacf2, 0xa438, 0xf0ac, 0xa438, 0xb0f0, - 0xa438, 0xacae, 0xa438, 0xf0ac, 0xa438, 0xacf0, 0xa438, 0xacaa, - 0xa438, 0xa100, 0xa438, 0x0ce1, 0xa438, 0x8ff7, 0xa438, 0xbf88, - 0xa438, 0x8402, 0xa438, 0x6e7d, 0xa438, 0xaf26, 0xa438, 0xe9e1, - 0xa438, 0x8ff6, 0xa438, 0xbf88, 0xa438, 0x8402, 0xa438, 0x6e7d, - 0xa438, 0xaf26, 0xa438, 0xf520, 0xa438, 0xac86, 0xa438, 0xbf88, - 0xa438, 0x3f02, 0xa438, 0x6e9c, 0xa438, 0xad28, 0xa438, 0x03af, - 0xa438, 0x3324, 0xa438, 0xad38, 0xa438, 0x03af, 0xa438, 0x32e6, - 0xa438, 0xaf32, 0xa438, 0xfb00, 0xa436, 0xb87c, 0xa438, 0x8ff6, - 0xa436, 0xb87e, 0xa438, 0x0705, 0xa436, 0xb87c, 0xa438, 0x8ff8, - 0xa436, 0xb87e, 0xa438, 0x19cc, 0xa436, 0xb87c, 0xa438, 0x8ffa, - 0xa436, 0xb87e, 0xa438, 0x28e3, 0xa436, 0xb87c, 0xa438, 0x8ffc, - 0xa436, 0xb87e, 0xa438, 0x1047, 0xa436, 0xb87c, 0xa438, 0x8ffe, - 0xa436, 0xb87e, 0xa438, 0x0a45, 0xa436, 0xb85e, 0xa438, 0x271E, - 0xa436, 0xb860, 0xa438, 0x3846, 0xa436, 0xb862, 0xa438, 0x26E6, - 0xa436, 0xb864, 0xa438, 0x32E3, 0xa436, 0xb886, 0xa438, 0xffff, - 0xa436, 0xb888, 0xa438, 0xffff, 0xa436, 0xb88a, 0xa438, 0xffff, - 0xa436, 0xb88c, 0xa438, 0xffff, 0xa436, 0xb838, 0xa438, 0x000f, - 0xb820, 0x0010, 0xa436, 0x846e, 0xa438, 0xaf84, 0xa438, 0x86af, - 0xa438, 0x8690, 0xa438, 0xaf86, 0xa438, 0xa4af, 0xa438, 0x86a4, - 0xa438, 0xaf86, 0xa438, 0xa4af, 0xa438, 0x86a4, 0xa438, 0xaf86, - 0xa438, 0xa4af, 0xa438, 0x86a4, 0xa438, 0xee82, 0xa438, 0x5f00, - 0xa438, 0x0284, 0xa438, 0x90af, 0xa438, 0x0441, 0xa438, 0xf8e0, - 0xa438, 0x8ff3, 0xa438, 0xa000, 0xa438, 0x0502, 0xa438, 0x84a4, - 0xa438, 0xae06, 0xa438, 0xa001, 0xa438, 0x0302, 0xa438, 0x84c8, - 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef59, 0xa438, 0xe080, - 0xa438, 0x15ad, 0xa438, 0x2702, 0xa438, 0xae03, 0xa438, 0xaf84, - 0xa438, 0xc3bf, 0xa438, 0x53ca, 0xa438, 0x0252, 0xa438, 0xc8ad, - 0xa438, 0x2807, 0xa438, 0x0285, 0xa438, 0x2cee, 0xa438, 0x8ff3, - 0xa438, 0x01ef, 0xa438, 0x95fd, 0xa438, 0xfc04, 0xa438, 0xf8f9, - 0xa438, 0xfaef, 0xa438, 0x69bf, 0xa438, 0x53ca, 0xa438, 0x0252, - 0xa438, 0xc8ac, 0xa438, 0x2822, 0xa438, 0xd480, 0xa438, 0x00bf, - 0xa438, 0x8684, 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x8687, - 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x868a, 0xa438, 0x0252, - 0xa438, 0xa9bf, 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9ee, - 0xa438, 0x8ff3, 0xa438, 0x00af, 0xa438, 0x8526, 0xa438, 0xe08f, - 0xa438, 0xf4e1, 0xa438, 0x8ff5, 0xa438, 0xe28f, 0xa438, 0xf6e3, - 0xa438, 0x8ff7, 0xa438, 0x1b45, 0xa438, 0xac27, 0xa438, 0x0eee, - 0xa438, 0x8ff4, 0xa438, 0x00ee, 0xa438, 0x8ff5, 0xa438, 0x0002, - 0xa438, 0x852c, 0xa438, 0xaf85, 0xa438, 0x26e0, 0xa438, 0x8ff4, - 0xa438, 0xe18f, 0xa438, 0xf52c, 0xa438, 0x0001, 0xa438, 0xe48f, - 0xa438, 0xf4e5, 0xa438, 0x8ff5, 0xa438, 0xef96, 0xa438, 0xfefd, - 0xa438, 0xfc04, 0xa438, 0xf8f9, 0xa438, 0xef59, 0xa438, 0xbf53, - 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa18b, 0xa438, 0x02ae, - 0xa438, 0x03af, 0xa438, 0x85da, 0xa438, 0xbf57, 0xa438, 0x7202, - 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xf8e5, 0xa438, 0x8ff9, - 0xa438, 0xbf57, 0xa438, 0x7502, 0xa438, 0x52c8, 0xa438, 0xe48f, - 0xa438, 0xfae5, 0xa438, 0x8ffb, 0xa438, 0xbf57, 0xa438, 0x7802, - 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfce5, 0xa438, 0x8ffd, - 0xa438, 0xbf57, 0xa438, 0x7b02, 0xa438, 0x52c8, 0xa438, 0xe48f, - 0xa438, 0xfee5, 0xa438, 0x8fff, 0xa438, 0xbf57, 0xa438, 0x6c02, - 0xa438, 0x52c8, 0xa438, 0xa102, 0xa438, 0x13ee, 0xa438, 0x8ffc, - 0xa438, 0x80ee, 0xa438, 0x8ffd, 0xa438, 0x00ee, 0xa438, 0x8ffe, - 0xa438, 0x80ee, 0xa438, 0x8fff, 0xa438, 0x00af, 0xa438, 0x8599, - 0xa438, 0xa101, 0xa438, 0x0cbf, 0xa438, 0x534c, 0xa438, 0x0252, - 0xa438, 0xc8a1, 0xa438, 0x0303, 0xa438, 0xaf85, 0xa438, 0x77bf, - 0xa438, 0x5322, 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x8b02, - 0xa438, 0xae03, 0xa438, 0xaf86, 0xa438, 0x64e0, 0xa438, 0x8ff8, - 0xa438, 0xe18f, 0xa438, 0xf9bf, 0xa438, 0x8684, 0xa438, 0x0252, - 0xa438, 0xa9e0, 0xa438, 0x8ffa, 0xa438, 0xe18f, 0xa438, 0xfbbf, - 0xa438, 0x8687, 0xa438, 0x0252, 0xa438, 0xa9e0, 0xa438, 0x8ffc, - 0xa438, 0xe18f, 0xa438, 0xfdbf, 0xa438, 0x868a, 0xa438, 0x0252, - 0xa438, 0xa9e0, 0xa438, 0x8ffe, 0xa438, 0xe18f, 0xa438, 0xffbf, - 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9af, 0xa438, 0x867f, - 0xa438, 0xbf53, 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa144, - 0xa438, 0x3cbf, 0xa438, 0x547b, 0xa438, 0x0252, 0xa438, 0xc8e4, - 0xa438, 0x8ff8, 0xa438, 0xe58f, 0xa438, 0xf9bf, 0xa438, 0x547e, - 0xa438, 0x0252, 0xa438, 0xc8e4, 0xa438, 0x8ffa, 0xa438, 0xe58f, - 0xa438, 0xfbbf, 0xa438, 0x5481, 0xa438, 0x0252, 0xa438, 0xc8e4, - 0xa438, 0x8ffc, 0xa438, 0xe58f, 0xa438, 0xfdbf, 0xa438, 0x5484, - 0xa438, 0x0252, 0xa438, 0xc8e4, 0xa438, 0x8ffe, 0xa438, 0xe58f, - 0xa438, 0xffbf, 0xa438, 0x5322, 0xa438, 0x0252, 0xa438, 0xc8a1, - 0xa438, 0x4448, 0xa438, 0xaf85, 0xa438, 0xa7bf, 0xa438, 0x5322, - 0xa438, 0x0252, 0xa438, 0xc8a1, 0xa438, 0x313c, 0xa438, 0xbf54, - 0xa438, 0x7b02, 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xf8e5, - 0xa438, 0x8ff9, 0xa438, 0xbf54, 0xa438, 0x7e02, 0xa438, 0x52c8, - 0xa438, 0xe48f, 0xa438, 0xfae5, 0xa438, 0x8ffb, 0xa438, 0xbf54, - 0xa438, 0x8102, 0xa438, 0x52c8, 0xa438, 0xe48f, 0xa438, 0xfce5, - 0xa438, 0x8ffd, 0xa438, 0xbf54, 0xa438, 0x8402, 0xa438, 0x52c8, - 0xa438, 0xe48f, 0xa438, 0xfee5, 0xa438, 0x8fff, 0xa438, 0xbf53, - 0xa438, 0x2202, 0xa438, 0x52c8, 0xa438, 0xa131, 0xa438, 0x03af, - 0xa438, 0x85a7, 0xa438, 0xd480, 0xa438, 0x00bf, 0xa438, 0x8684, - 0xa438, 0x0252, 0xa438, 0xa9bf, 0xa438, 0x8687, 0xa438, 0x0252, - 0xa438, 0xa9bf, 0xa438, 0x868a, 0xa438, 0x0252, 0xa438, 0xa9bf, - 0xa438, 0x868d, 0xa438, 0x0252, 0xa438, 0xa9ef, 0xa438, 0x95fd, - 0xa438, 0xfc04, 0xa438, 0xf0d1, 0xa438, 0x2af0, 0xa438, 0xd12c, - 0xa438, 0xf0d1, 0xa438, 0x44f0, 0xa438, 0xd146, 0xa438, 0xbf86, - 0xa438, 0xa102, 0xa438, 0x52c8, 0xa438, 0xbf86, 0xa438, 0xa102, - 0xa438, 0x52c8, 0xa438, 0xd101, 0xa438, 0xaf06, 0xa438, 0xa570, - 0xa438, 0xce42, 0xa436, 0xb818, 0xa438, 0x043d, 0xa436, 0xb81a, - 0xa438, 0x06a3, 0xa436, 0xb81c, 0xa438, 0xffff, 0xa436, 0xb81e, - 0xa438, 0xffff, 0xa436, 0xb850, 0xa438, 0xffff, 0xa436, 0xb852, - 0xa438, 0xffff, 0xa436, 0xb878, 0xa438, 0xffff, 0xa436, 0xb884, - 0xa438, 0xffff, 0xa436, 0xb832, 0xa438, 0x0003, 0xa436, 0x0000, - 0xa438, 0x0000, 0xa436, 0xB82E, 0xa438, 0x0000, 0xa436, 0x8024, - 0xa438, 0x0000, 0xa436, 0x801E, 0xa438, 0x0021, 0xb820, 0x0000, - 0xFFFF, 0xFFFF -}; - static const u16 phy_mcu_ram_code_8126a_1_1[] = { 0xa436, 0x8023, 0xa438, 0x4900, 0xa436, 0xB82E, 0xa438, 0x0001, 0xBFBA, 0xE000, 0xBF1A, 0xC1B9, 0xBFA8, 0x10F0, 0xBFB0, 0x0210, @@ -13054,1699 +10103,1385 @@ static const u16 phy_mcu_ram_code_8126a_2_3[] = { 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 const u16 phy_mcu_ram_code_8126a_3_1[] = { + 0xa436, 0x8023, 0xa438, 0x4701, 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, 0x802a, + 0xa438, 0x1800, 0xa438, 0x8032, 0xa438, 0x1800, 0xa438, 0x803a, + 0xa438, 0x1800, 0xa438, 0x803e, 0xa438, 0x1800, 0xa438, 0x8044, + 0xa438, 0x1800, 0xa438, 0x804b, 0xa438, 0xd504, 0xa438, 0xc9b5, + 0xa438, 0xd500, 0xa438, 0xd707, 0xa438, 0x4070, 0xa438, 0x1800, + 0xa438, 0x1082, 0xa438, 0xd504, 0xa438, 0x1800, 0xa438, 0x107a, + 0xa438, 0x61d0, 0xa438, 0xd701, 0xa438, 0x60a5, 0xa438, 0xd504, + 0xa438, 0xc9b2, 0xa438, 0xd500, 0xa438, 0xf004, 0xa438, 0xd504, + 0xa438, 0xc9b1, 0xa438, 0xd500, 0xa438, 0xd707, 0xa438, 0x6070, + 0xa438, 0x1800, 0xa438, 0x10b0, 0xa438, 0x1800, 0xa438, 0x10c5, + 0xa438, 0xd707, 0xa438, 0x2005, 0xa438, 0x8030, 0xa438, 0xd75e, + 0xa438, 0x1800, 0xa438, 0x138c, 0xa438, 0x1800, 0xa438, 0x13ff, + 0xa438, 0xc504, 0xa438, 0xce20, 0xa438, 0xcf01, 0xa438, 0xd70a, + 0xa438, 0x4005, 0xa438, 0xcf02, 0xa438, 0x1800, 0xa438, 0x1b99, + 0xa438, 0xa980, 0xa438, 0xd500, 0xa438, 0x1800, 0xa438, 0x144d, + 0xa438, 0x907f, 0xa438, 0x91a3, 0xa438, 0x9306, 0xa438, 0xb118, + 0xa438, 0x1800, 0xa438, 0x2147, 0xa438, 0x907f, 0xa438, 0x9209, + 0xa438, 0x91a3, 0xa438, 0x9306, 0xa438, 0xb118, 0xa438, 0x1800, + 0xa438, 0x203c, 0xa436, 0xA026, 0xa438, 0xffff, 0xa436, 0xA024, + 0xa438, 0x2033, 0xa436, 0xA022, 0xa438, 0x213f, 0xa436, 0xA020, + 0xa438, 0x144c, 0xa436, 0xA006, 0xa438, 0x1b98, 0xa436, 0xA004, + 0xa438, 0x138b, 0xa436, 0xA002, 0xa438, 0x10c4, 0xa436, 0xA000, + 0xa438, 0x1079, 0xa436, 0xA008, 0xa438, 0x7f00, 0xa436, 0xA016, + 0xa438, 0x0000, 0xa436, 0xA012, 0xa438, 0x0ff8, 0xa436, 0xA014, + 0xa438, 0xd04d, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, + 0xa436, 0xA152, 0xa438, 0x12dc, 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, 0xa436, 0xA016, 0xa438, 0x0020, + 0xa436, 0xA012, 0xa438, 0x0000, 0xa436, 0xA014, 0xa438, 0x1800, + 0xa438, 0x8010, 0xa438, 0x1800, 0xa438, 0x801a, 0xa438, 0x1800, + 0xa438, 0x801a, 0xa438, 0x1800, 0xa438, 0x810a, 0xa438, 0x1800, + 0xa438, 0x8111, 0xa438, 0x1800, 0xa438, 0x8341, 0xa438, 0x1800, + 0xa438, 0x8349, 0xa438, 0x1800, 0xa438, 0x83df, 0xa438, 0xd706, + 0xa438, 0x60a9, 0xa438, 0xd700, 0xa438, 0x60a1, 0xa438, 0x1800, + 0xa438, 0x0962, 0xa438, 0x1800, 0xa438, 0x0962, 0xa438, 0x1800, + 0xa438, 0x0982, 0xa438, 0xd70d, 0xa438, 0x40fd, 0xa438, 0xd702, + 0xa438, 0x40a0, 0xa438, 0xd70c, 0xa438, 0x4066, 0xa438, 0x8710, + 0xa438, 0xf002, 0xa438, 0xa710, 0xa438, 0x9580, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0xa304, 0xa438, 0x9503, 0xa438, 0x0c1f, + 0xa438, 0x0d07, 0xa438, 0x8dc0, 0xa438, 0x1000, 0xa438, 0x12b5, + 0xa438, 0xcb81, 0xa438, 0xd70c, 0xa438, 0x4882, 0xa438, 0xd706, + 0xa438, 0x407a, 0xa438, 0xd70c, 0xa438, 0x4807, 0xa438, 0xd706, + 0xa438, 0x405a, 0xa438, 0x8910, 0xa438, 0xa210, 0xa438, 0xd704, + 0xa438, 0x611c, 0xa438, 0x0cc0, 0xa438, 0x0080, 0xa438, 0x0c03, + 0xa438, 0x0101, 0xa438, 0x0ce0, 0xa438, 0x03a0, 0xa438, 0xccb5, + 0xa438, 0x0cc0, 0xa438, 0x0080, 0xa438, 0x0c03, 0xa438, 0x0102, + 0xa438, 0x0ce0, 0xa438, 0x0340, 0xa438, 0xcc52, 0xa438, 0xd706, + 0xa438, 0x42ba, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x0c1f, + 0xa438, 0x0f1c, 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd70c, 0xa438, 0x5fb3, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0x8f1f, 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd70c, 0xa438, 0x7f33, 0xa438, 0x8190, 0xa438, 0x8204, + 0xa438, 0xf016, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x0c1f, + 0xa438, 0x0f1b, 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd70c, 0xa438, 0x5fb3, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0x8f1f, 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd70c, 0xa438, 0x7f33, 0xa438, 0xd70c, 0xa438, 0x6047, + 0xa438, 0xf002, 0xa438, 0xf00c, 0xa438, 0xd403, 0xa438, 0xcb82, + 0xa438, 0x1000, 0xa438, 0x1203, 0xa438, 0xd40a, 0xa438, 0x1000, + 0xa438, 0x1203, 0xa438, 0xd70c, 0xa438, 0x4247, 0xa438, 0x1000, + 0xa438, 0x131d, 0xa438, 0x8a40, 0xa438, 0x1000, 0xa438, 0x120e, + 0xa438, 0xa104, 0xa438, 0x1000, 0xa438, 0x1220, 0xa438, 0x8104, + 0xa438, 0x1000, 0xa438, 0x1217, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xa704, 0xa438, 0x9503, 0xa438, 0xcb88, 0xa438, 0xf012, + 0xa438, 0xa210, 0xa438, 0xa00a, 0xa438, 0xaa40, 0xa438, 0x1000, + 0xa438, 0x120e, 0xa438, 0xa104, 0xa438, 0x1000, 0xa438, 0x1220, + 0xa438, 0x8104, 0xa438, 0x1000, 0xa438, 0x1217, 0xa438, 0xa190, + 0xa438, 0xa284, 0xa438, 0xa404, 0xa438, 0x8a10, 0xa438, 0x8a80, + 0xa438, 0xcb84, 0xa438, 0xd13e, 0xa438, 0xd05a, 0xa438, 0xd13e, + 0xa438, 0xd06b, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, + 0xa438, 0x3559, 0xa438, 0x80a8, 0xa438, 0xfffb, 0xa438, 0xd700, + 0xa438, 0x604b, 0xa438, 0xcb8a, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x3659, 0xa438, 0x80b1, 0xa438, 0xfffb, + 0xa438, 0xd700, 0xa438, 0x606b, 0xa438, 0xcb8b, 0xa438, 0x5eeb, + 0xa438, 0xd700, 0xa438, 0x6041, 0xa438, 0xa402, 0xa438, 0xcb8c, + 0xa438, 0xd706, 0xa438, 0x609a, 0xa438, 0xd1b7, 0xa438, 0xd049, + 0xa438, 0xf003, 0xa438, 0xd160, 0xa438, 0xd04b, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xcb8d, + 0xa438, 0x8710, 0xa438, 0xd71f, 0xa438, 0x5fd4, 0xa438, 0xb920, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, 0xa438, 0x7fb4, + 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, + 0xa438, 0x6105, 0xa438, 0x6054, 0xa438, 0xfffb, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fab, 0xa438, 0xfff0, + 0xa438, 0xa710, 0xa438, 0xb820, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd71f, 0xa438, 0x7fa5, 0xa438, 0x9820, 0xa438, 0xd114, + 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, + 0xa438, 0x5fba, 0xa438, 0xd704, 0xa438, 0x5f76, 0xa438, 0xd700, + 0xa438, 0x5f34, 0xa438, 0xd700, 0xa438, 0x6081, 0xa438, 0xd706, + 0xa438, 0x405a, 0xa438, 0xa480, 0xa438, 0xcb86, 0xa438, 0xd706, + 0xa438, 0x609a, 0xa438, 0xd1c8, 0xa438, 0xd045, 0xa438, 0xf003, + 0xa438, 0xd17a, 0xa438, 0xd04b, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x0cc0, 0xa438, 0x0000, + 0xa438, 0x0c03, 0xa438, 0x0101, 0xa438, 0x0ce0, 0xa438, 0x0320, + 0xa438, 0xcc29, 0xa438, 0xa208, 0xa438, 0x8204, 0xa438, 0xd114, + 0xa438, 0xd040, 0xa438, 0xd700, 0xa438, 0x5ff4, 0xa438, 0x1800, + 0xa438, 0x0c3e, 0xa438, 0xd706, 0xa438, 0x609d, 0xa438, 0xd417, + 0xa438, 0x1000, 0xa438, 0x1203, 0xa438, 0x1800, 0xa438, 0x0d2e, + 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0xd70c, 0xa438, 0x5fa4, + 0xa438, 0xa706, 0xa438, 0xd70c, 0xa438, 0x408b, 0xa438, 0xa701, + 0xa438, 0xa502, 0xa438, 0xa880, 0xa438, 0x8801, 0xa438, 0x8e01, + 0xa438, 0xca50, 0xa438, 0x1000, 0xa438, 0x81b6, 0xa438, 0xca51, + 0xa438, 0xd70e, 0xa438, 0x2210, 0xa438, 0x81b4, 0xa438, 0xd70c, + 0xa438, 0x4084, 0xa438, 0xd705, 0xa438, 0x5efd, 0xa438, 0xf007, + 0xa438, 0x1000, 0xa438, 0x17c2, 0xa438, 0xd70c, 0xa438, 0x5ca2, + 0xa438, 0x1800, 0xa438, 0x1692, 0xa438, 0xd70c, 0xa438, 0x605a, + 0xa438, 0x9a10, 0xa438, 0x8e40, 0xa438, 0x8404, 0xa438, 0x1000, + 0xa438, 0x1827, 0xa438, 0x8e80, 0xa438, 0xca62, 0xa438, 0xd705, + 0xa438, 0x3084, 0xa438, 0x8196, 0xa438, 0xba10, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa438, 0x1000, 0xa438, 0x8290, 0xa438, 0x0c03, + 0xa438, 0x0100, 0xa438, 0xd702, 0xa438, 0x4638, 0xa438, 0xd1c4, + 0xa438, 0xd044, 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0x1000, + 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f7c, 0xa438, 0x8108, + 0xa438, 0x0c1f, 0xa438, 0x0907, 0xa438, 0x8940, 0xa438, 0x1000, + 0xa438, 0x17db, 0xa438, 0xa0c4, 0xa438, 0x8610, 0xa438, 0x8030, + 0xa438, 0x8706, 0xa438, 0x0c07, 0xa438, 0x0b06, 0xa438, 0x8410, + 0xa438, 0xa980, 0xa438, 0xa702, 0xa438, 0xd1c4, 0xa438, 0xd045, + 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0x1000, 0xa438, 0x17e8, + 0xa438, 0xd70c, 0xa438, 0x5f7c, 0xa438, 0x0c07, 0xa438, 0x0b06, + 0xa438, 0xa030, 0xa438, 0xa610, 0xa438, 0xd700, 0xa438, 0x6041, + 0xa438, 0xa501, 0xa438, 0xa108, 0xa438, 0xd1c4, 0xa438, 0xd045, + 0xa438, 0xca63, 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0x1000, + 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f7c, 0xa438, 0xd702, + 0xa438, 0x6078, 0xa438, 0x9920, 0xa438, 0xf003, 0xa438, 0xb920, + 0xa438, 0xa880, 0xa438, 0x9a10, 0xa438, 0x1000, 0xa438, 0x17be, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd71f, 0xa438, 0x5f73, + 0xa438, 0xf011, 0xa438, 0xd70c, 0xa438, 0x409b, 0xa438, 0x9920, + 0xa438, 0x9a10, 0xa438, 0xfff5, 0xa438, 0x80fe, 0xa438, 0x8610, + 0xa438, 0x8501, 0xa438, 0x8980, 0xa438, 0x8702, 0xa438, 0xa410, + 0xa438, 0xa940, 0xa438, 0x81c0, 0xa438, 0xae80, 0xa438, 0x1800, + 0xa438, 0x813b, 0xa438, 0x8804, 0xa438, 0xa704, 0xa438, 0x8788, + 0xa438, 0xff80, 0xa438, 0xbb08, 0xa438, 0x0c1f, 0xa438, 0x0907, + 0xa438, 0x8940, 0xa438, 0x1000, 0xa438, 0x17db, 0xa438, 0x8701, + 0xa438, 0x8502, 0xa438, 0xa0f4, 0xa438, 0xa610, 0xa438, 0xd700, + 0xa438, 0x6061, 0xa438, 0xa002, 0xa438, 0xa501, 0xa438, 0x8706, + 0xa438, 0x8410, 0xa438, 0xa980, 0xa438, 0xca64, 0xa438, 0xd110, + 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0x1000, + 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f7c, 0xa438, 0x8804, + 0xa438, 0xa706, 0xa438, 0x1800, 0xa438, 0x8115, 0xa438, 0x1800, + 0xa438, 0x147c, 0xa438, 0xd705, 0xa438, 0x405f, 0xa438, 0xf036, + 0xa438, 0xd705, 0xa438, 0x6234, 0xa438, 0xd70c, 0xa438, 0x41c6, + 0xa438, 0xd70d, 0xa438, 0x419d, 0xa438, 0xd70d, 0xa438, 0x417e, + 0xa438, 0xd704, 0xa438, 0x6127, 0xa438, 0x2951, 0xa438, 0x81cb, + 0xa438, 0xd70c, 0xa438, 0x4083, 0xa438, 0xd70c, 0xa438, 0x2e81, + 0xa438, 0x81cb, 0xa438, 0xf0c5, 0xa438, 0x80fe, 0xa438, 0x8610, + 0xa438, 0x8501, 0xa438, 0x8704, 0xa438, 0x0c30, 0xa438, 0x0410, + 0xa438, 0xa701, 0xa438, 0xac02, 0xa438, 0xa502, 0xa438, 0x8980, + 0xa438, 0xca60, 0xa438, 0xa004, 0xa438, 0xd70c, 0xa438, 0x6065, + 0xa438, 0x1800, 0xa438, 0x81dc, 0xa438, 0x8004, 0xa438, 0xa804, + 0xa438, 0x0c0f, 0xa438, 0x0602, 0xa438, 0x0c70, 0xa438, 0x0730, + 0xa438, 0xa708, 0xa438, 0xd704, 0xa438, 0x609c, 0xa438, 0x0c1f, + 0xa438, 0x0912, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x090e, + 0xa438, 0xa940, 0xa438, 0x1000, 0xa438, 0x17db, 0xa438, 0xa780, + 0xa438, 0xf0a2, 0xa438, 0xd704, 0xa438, 0x63eb, 0xa438, 0xd705, + 0xa438, 0x43b1, 0xa438, 0xd702, 0xa438, 0x339c, 0xa438, 0x828f, + 0xa438, 0x8788, 0xa438, 0x8704, 0xa438, 0x0c1f, 0xa438, 0x0907, + 0xa438, 0x8940, 0xa438, 0x1000, 0xa438, 0x17db, 0xa438, 0x8410, + 0xa438, 0xa0f4, 0xa438, 0xa610, 0xa438, 0xd700, 0xa438, 0x6061, + 0xa438, 0xa002, 0xa438, 0xa501, 0xa438, 0xa706, 0xa438, 0x8804, + 0xa438, 0xa980, 0xa438, 0xd70c, 0xa438, 0x6085, 0xa438, 0x8701, + 0xa438, 0x8502, 0xa438, 0x8c02, 0xa438, 0xa701, 0xa438, 0xa502, + 0xa438, 0xf082, 0xa438, 0xd70c, 0xa438, 0x60c5, 0xa438, 0xd702, + 0xa438, 0x6053, 0xa438, 0xf07d, 0xa438, 0x1800, 0xa438, 0x828c, + 0xa438, 0xd70d, 0xa438, 0x4d1b, 0xa438, 0xba10, 0xa438, 0xae40, + 0xa438, 0x0cfc, 0xa438, 0x03b4, 0xa438, 0x0cfc, 0xa438, 0x05b4, + 0xa438, 0xd1c4, 0xa438, 0xd044, 0xa438, 0x1000, 0xa438, 0x17be, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f7c, + 0xa438, 0x8706, 0xa438, 0x8280, 0xa438, 0xace0, 0xa438, 0xa680, + 0xa438, 0xa240, 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0x1000, + 0xa438, 0x17e8, 0xa438, 0xd702, 0xa438, 0x5f79, 0xa438, 0x8240, + 0xa438, 0xd702, 0xa438, 0x6898, 0xa438, 0xd702, 0xa438, 0x4957, + 0xa438, 0x1800, 0xa438, 0x827e, 0xa438, 0xa1c0, 0xa438, 0x0c3f, + 0xa438, 0x0220, 0xa438, 0x0cfc, 0xa438, 0x030c, 0xa438, 0x0cfc, + 0xa438, 0x050c, 0xa438, 0x8108, 0xa438, 0x8640, 0xa438, 0xa120, + 0xa438, 0xa640, 0xa438, 0x0c03, 0xa438, 0x0101, 0xa438, 0xa110, + 0xa438, 0xd1c4, 0xa438, 0xd044, 0xa438, 0xca84, 0xa438, 0x1000, + 0xa438, 0x17be, 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd70c, + 0xa438, 0x5f7c, 0xa438, 0xd702, 0xa438, 0x60fc, 0xa438, 0x8210, + 0xa438, 0x0ce0, 0xa438, 0x0320, 0xa438, 0x0ce0, 0xa438, 0x0520, + 0xa438, 0xf002, 0xa438, 0xa210, 0xa438, 0xd1c4, 0xa438, 0xd043, + 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0x1000, 0xa438, 0x17e8, + 0xa438, 0xd70c, 0xa438, 0x5f7c, 0xa438, 0x8233, 0xa438, 0x0cfc, + 0xa438, 0x036c, 0xa438, 0x0cfc, 0xa438, 0x056c, 0xa438, 0xd1c4, + 0xa438, 0xd044, 0xa438, 0xca85, 0xa438, 0x1000, 0xa438, 0x17be, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f7c, + 0xa438, 0xa680, 0xa438, 0xa240, 0xa438, 0x1000, 0xa438, 0x17be, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd702, 0xa438, 0x5f79, + 0xa438, 0x8240, 0xa438, 0x0cfc, 0xa438, 0x0390, 0xa438, 0x0cfc, + 0xa438, 0x0590, 0xa438, 0xd702, 0xa438, 0x6058, 0xa438, 0xf002, + 0xa438, 0xfec7, 0xa438, 0x81c0, 0xa438, 0x8880, 0xa438, 0x8706, + 0xa438, 0xca61, 0xa438, 0xd1c4, 0xa438, 0xd054, 0xa438, 0x1000, + 0xa438, 0x17be, 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd70c, + 0xa438, 0x5f7d, 0xa438, 0xa706, 0xa438, 0xf004, 0xa438, 0x8788, + 0xa438, 0xa404, 0xa438, 0x8702, 0xa438, 0x0800, 0xa438, 0x8443, + 0xa438, 0x8303, 0xa438, 0x8280, 0xa438, 0x9920, 0xa438, 0x8ce0, + 0xa438, 0x8004, 0xa438, 0xa1c0, 0xa438, 0xd70e, 0xa438, 0x404a, + 0xa438, 0xa280, 0xa438, 0xd702, 0xa438, 0x3bd0, 0xa438, 0x82a0, + 0xa438, 0x0c3f, 0xa438, 0x0223, 0xa438, 0xf003, 0xa438, 0x0c3f, + 0xa438, 0x0220, 0xa438, 0x0cfc, 0xa438, 0x0308, 0xa438, 0x0cfc, + 0xa438, 0x0508, 0xa438, 0x8108, 0xa438, 0x8640, 0xa438, 0xa120, + 0xa438, 0xa640, 0xa438, 0xd702, 0xa438, 0x6077, 0xa438, 0x8103, + 0xa438, 0xf003, 0xa438, 0x0c03, 0xa438, 0x0101, 0xa438, 0xa110, + 0xa438, 0xd702, 0xa438, 0x6077, 0xa438, 0xa108, 0xa438, 0xf006, + 0xa438, 0xd704, 0xa438, 0x6077, 0xa438, 0x8108, 0xa438, 0xf002, + 0xa438, 0xa108, 0xa438, 0xd193, 0xa438, 0xd045, 0xa438, 0xca82, + 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0xd70e, 0xa438, 0x606a, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f3c, + 0xa438, 0xd702, 0xa438, 0x60fc, 0xa438, 0x8210, 0xa438, 0x0ce0, + 0xa438, 0x0320, 0xa438, 0x0ce0, 0xa438, 0x0520, 0xa438, 0xf002, + 0xa438, 0xa210, 0xa438, 0xd1c4, 0xa438, 0xd043, 0xa438, 0x1000, + 0xa438, 0x17be, 0xa438, 0xd70e, 0xa438, 0x606a, 0xa438, 0x1000, + 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f3c, 0xa438, 0xd702, + 0xa438, 0x3bd0, 0xa438, 0x82de, 0xa438, 0x0c3f, 0xa438, 0x020c, + 0xa438, 0xf002, 0xa438, 0x823f, 0xa438, 0x0cfc, 0xa438, 0x034c, + 0xa438, 0x0cfc, 0xa438, 0x054c, 0xa438, 0xd1c4, 0xa438, 0xd044, + 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0xd70e, 0xa438, 0x606a, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f3c, + 0xa438, 0x820c, 0xa438, 0xa360, 0xa438, 0xa560, 0xa438, 0xd1c4, + 0xa438, 0xd043, 0xa438, 0xca83, 0xa438, 0x1000, 0xa438, 0x17be, + 0xa438, 0xd70e, 0xa438, 0x606a, 0xa438, 0x1000, 0xa438, 0x17e8, + 0xa438, 0xd70c, 0xa438, 0x5f3c, 0xa438, 0xd70e, 0xa438, 0x406a, + 0xa438, 0x8680, 0xa438, 0xf002, 0xa438, 0xa680, 0xa438, 0xa240, + 0xa438, 0x0c0f, 0xa438, 0x0604, 0xa438, 0x0c70, 0xa438, 0x0750, + 0xa438, 0xa708, 0xa438, 0xd704, 0xa438, 0x609c, 0xa438, 0x0c1f, + 0xa438, 0x0914, 0xa438, 0xf003, 0xa438, 0x0c1f, 0xa438, 0x0910, + 0xa438, 0xa940, 0xa438, 0x1000, 0xa438, 0x17db, 0xa438, 0xa780, + 0xa438, 0x1000, 0xa438, 0x17be, 0xa438, 0xd70e, 0xa438, 0x606a, + 0xa438, 0x1000, 0xa438, 0x17e8, 0xa438, 0xd702, 0xa438, 0x399c, + 0xa438, 0x8311, 0xa438, 0x8240, 0xa438, 0x8788, 0xa438, 0xd702, + 0xa438, 0x63f8, 0xa438, 0xd705, 0xa438, 0x643c, 0xa438, 0xa402, + 0xa438, 0xf012, 0xa438, 0x8402, 0xa438, 0xd705, 0xa438, 0x611b, + 0xa438, 0xa401, 0xa438, 0xa302, 0xa438, 0xd702, 0xa438, 0x417d, + 0xa438, 0xa440, 0xa438, 0xa280, 0xa438, 0xf008, 0xa438, 0x8401, + 0xa438, 0x8302, 0xa438, 0xd70c, 0xa438, 0x6060, 0xa438, 0xa301, + 0xa438, 0xf002, 0xa438, 0x8301, 0xa438, 0xd70c, 0xa438, 0x4080, + 0xa438, 0xd70e, 0xa438, 0x604a, 0xa438, 0xff5f, 0xa438, 0xd705, + 0xa438, 0x3cdd, 0xa438, 0x8340, 0xa438, 0xff5b, 0xa438, 0x0cfc, + 0xa438, 0x0390, 0xa438, 0x0cfc, 0xa438, 0x0590, 0xa438, 0x0800, + 0xa438, 0xcb50, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xa310, + 0xa438, 0x9503, 0xa438, 0xcb5f, 0xa438, 0x1800, 0xa438, 0x0d3e, + 0xa438, 0xcb13, 0xa438, 0xd706, 0xa438, 0x6089, 0xa438, 0xd1b8, + 0xa438, 0xd04a, 0xa438, 0xf003, 0xa438, 0xd11c, 0xa438, 0xd04b, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd701, 0xa438, 0x67d5, + 0xa438, 0xd700, 0xa438, 0x5f74, 0xa438, 0xd70c, 0xa438, 0x610c, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x6846, + 0xa438, 0xd706, 0xa438, 0x647b, 0xa438, 0xfffa, 0xa438, 0x1000, + 0xa438, 0x1330, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x0c1f, + 0xa438, 0x0f16, 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd70c, 0xa438, 0x5fb3, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0x8f1f, 0xa438, 0x9503, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd70c, 0xa438, 0x7f33, 0xa438, 0x1000, 0xa438, 0x12b5, + 0xa438, 0x0c07, 0xa438, 0x0c02, 0xa438, 0x0cc0, 0xa438, 0x0080, + 0xa438, 0xd14a, 0xa438, 0xd048, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x1800, 0xa438, 0x8359, + 0xa438, 0x800a, 0xa438, 0x1000, 0xa438, 0x120e, 0xa438, 0xa004, + 0xa438, 0x1000, 0xa438, 0x1220, 0xa438, 0x8004, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x1220, 0xa438, 0x8001, 0xa438, 0x1000, + 0xa438, 0x1217, 0xa438, 0x0c03, 0xa438, 0x0902, 0xa438, 0x1800, + 0xa438, 0x04ed, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, + 0xa438, 0x5fab, 0xa438, 0xba08, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd71f, 0xa438, 0x7f8b, 0xa438, 0x9a08, 0xa438, 0x1800, + 0xa438, 0x0581, 0xa438, 0x800a, 0xa438, 0xd702, 0xa438, 0x6555, + 0xa438, 0x1000, 0xa438, 0x120e, 0xa438, 0xa004, 0xa438, 0x1000, + 0xa438, 0x1220, 0xa438, 0x8004, 0xa438, 0xa001, 0xa438, 0x1000, + 0xa438, 0x1220, 0xa438, 0x8001, 0xa438, 0x1000, 0xa438, 0x1217, + 0xa438, 0xa00a, 0xa438, 0xa780, 0xa438, 0xcb14, 0xa438, 0xd1b8, + 0xa438, 0xd04a, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0x6286, 0xa438, 0xd706, 0xa438, 0x5f5b, + 0xa438, 0x800a, 0xa438, 0x1000, 0xa438, 0x120e, 0xa438, 0xa004, + 0xa438, 0x1000, 0xa438, 0x1220, 0xa438, 0x8004, 0xa438, 0xa001, + 0xa438, 0x1000, 0xa438, 0x1220, 0xa438, 0x8001, 0xa438, 0x1000, + 0xa438, 0x1217, 0xa438, 0x0c03, 0xa438, 0x0902, 0xa438, 0x1800, + 0xa438, 0x83a1, 0xa438, 0xa00a, 0xa438, 0x9308, 0xa438, 0xb210, + 0xa438, 0xb301, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd701, + 0xa438, 0x5fa4, 0xa438, 0xb302, 0xa438, 0x9210, 0xa438, 0xd409, + 0xa438, 0x1000, 0xa438, 0x1203, 0xa438, 0xd103, 0xa438, 0xd04c, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0x1800, 0xa438, 0x0581, 0xa438, 0xd70c, 0xa438, 0x60b3, + 0xa438, 0x1800, 0xa438, 0x83e3, 0xa438, 0x1800, 0xa438, 0x001a, + 0xa438, 0x1800, 0xa438, 0x12cb, 0xa436, 0xA10E, 0xa438, 0x12cf, + 0xa436, 0xA10C, 0xa438, 0x04f8, 0xa436, 0xA10A, 0xa438, 0x0d3d, + 0xa436, 0xA108, 0xa438, 0x15fb, 0xa436, 0xA106, 0xa438, 0x0d2b, + 0xa436, 0xA104, 0xa438, 0x0ecb, 0xa436, 0xA102, 0xa438, 0x09ca, + 0xa436, 0xA100, 0xa438, 0x0960, 0xa436, 0xA110, 0xa438, 0x00ff, + 0xa436, 0xA016, 0xa438, 0x0020, 0xa436, 0xA012, 0xa438, 0x1ff8, + 0xa436, 0xA014, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x0000, + 0xa438, 0x0000, 0xa436, 0xA164, 0xa438, 0x3fff, 0xa436, 0xA166, + 0xa438, 0x3fff, 0xa436, 0xA168, 0xa438, 0x3fff, 0xa436, 0xA16A, + 0xa438, 0x3fff, 0xa436, 0xA16C, 0xa438, 0x3fff, 0xa436, 0xA16E, + 0xa438, 0x3fff, 0xa436, 0xA170, 0xa438, 0x3fff, 0xa436, 0xA172, + 0xa438, 0x3fff, 0xa436, 0xA162, 0xa438, 0x0000, 0xa436, 0xb87c, + 0xa438, 0x8a63, 0xa436, 0xb87e, 0xa438, 0xaf8a, 0xa438, 0x7baf, + 0xa438, 0x8ab6, 0xa438, 0xaf8a, 0xa438, 0xd6af, 0xa438, 0x8ae4, + 0xa438, 0xaf8a, 0xa438, 0xf2af, 0xa438, 0x8b07, 0xa438, 0xaf8b, + 0xa438, 0x07af, 0xa438, 0x8b07, 0xa438, 0xad35, 0xa438, 0x27bf, + 0xa438, 0x7308, 0xa438, 0x027b, 0xa438, 0x07ac, 0xa438, 0x280d, + 0xa438, 0xbf73, 0xa438, 0x0b02, 0xa438, 0x7b07, 0xa438, 0xac28, + 0xa438, 0x04d0, 0xa438, 0x05ae, 0xa438, 0x02d0, 0xa438, 0x01d1, + 0xa438, 0x01d3, 0xa438, 0x04ee, 0xa438, 0x8640, 0xa438, 0x00ee, + 0xa438, 0x8641, 0xa438, 0x00af, 0xa438, 0x6aa6, 0xa438, 0xd100, + 0xa438, 0xd300, 0xa438, 0xee86, 0xa438, 0x4001, 0xa438, 0xee86, + 0xa438, 0x4124, 0xa438, 0xd00f, 0xa438, 0xaf6a, 0xa438, 0xa6bf, + 0xa438, 0x739e, 0xa438, 0x027b, 0xa438, 0x07ad, 0xa438, 0x280b, + 0xa438, 0xe18f, 0xa438, 0xfdad, 0xa438, 0x2805, 0xa438, 0xe08f, + 0xa438, 0xfeae, 0xa438, 0x03e0, 0xa438, 0x8fff, 0xa438, 0xe489, + 0xa438, 0xe7e0, 0xa438, 0x89e7, 0xa438, 0xaf67, 0xa438, 0x9fa0, + 0xa438, 0x9402, 0xa438, 0xae03, 0xa438, 0xa0b5, 0xa438, 0x03af, + 0xa438, 0x0d89, 0xa438, 0xaf0d, 0xa438, 0xafa0, 0xa438, 0x9402, + 0xa438, 0xae03, 0xa438, 0xa0b5, 0xa438, 0x03af, 0xa438, 0x0c64, + 0xa438, 0xaf0c, 0xa438, 0xcce0, 0xa438, 0x8013, 0xa438, 0x026b, + 0xa438, 0xa4ad, 0xa438, 0x2109, 0xa438, 0x0264, 0xa438, 0x47bf, + 0xa438, 0x769b, 0xa438, 0x027a, 0xa438, 0xbcaf, 0xa438, 0x6562, + 0xa436, 0xb85e, 0xa438, 0x6A7F, 0xa436, 0xb860, 0xa438, 0x679C, + 0xa436, 0xb862, 0xa438, 0x0d86, 0xa436, 0xb864, 0xa438, 0x0c61, + 0xa436, 0xb886, 0xa438, 0x6553, 0xa436, 0xb888, 0xa438, 0xffff, + 0xa436, 0xb88a, 0xa438, 0xffff, 0xa436, 0xb88c, 0xa438, 0xffff, + 0xa436, 0xb838, 0xa438, 0x001f, 0xb820, 0x0010, 0xa436, 0x8629, + 0xa438, 0xaf86, 0xa438, 0x41af, 0xa438, 0x8644, 0xa438, 0xaf88, + 0xa438, 0x0caf, 0xa438, 0x8813, 0xa438, 0xaf88, 0xa438, 0x4baf, + 0xa438, 0x884b, 0xa438, 0xaf88, 0xa438, 0x4baf, 0xa438, 0x884b, + 0xa438, 0xaf1d, 0xa438, 0x8a02, 0xa438, 0x864d, 0xa438, 0x0210, + 0xa438, 0x64af, 0xa438, 0x1063, 0xa438, 0xf8fa, 0xa438, 0xef69, + 0xa438, 0xe080, 0xa438, 0x4cac, 0xa438, 0x2517, 0xa438, 0xe080, + 0xa438, 0x40ad, 0xa438, 0x251a, 0xa438, 0x0286, 0xa438, 0x7ce0, + 0xa438, 0x8040, 0xa438, 0xac25, 0xa438, 0x11bf, 0xa438, 0x87f4, + 0xa438, 0x0277, 0xa438, 0xf6ae, 0xa438, 0x0902, 0xa438, 0x87b3, + 0xa438, 0x0287, 0xa438, 0xe902, 0xa438, 0x87de, 0xa438, 0xef96, + 0xa438, 0xfefc, 0xa438, 0x04f8, 0xa438, 0xe080, 0xa438, 0x18ad, + 0xa438, 0x2611, 0xa438, 0xe08f, 0xa438, 0x9cac, 0xa438, 0x2005, + 0xa438, 0x0286, 0xa438, 0x99ae, 0xa438, 0x0302, 0xa438, 0x8707, + 0xa438, 0x0287, 0xa438, 0x5002, 0xa438, 0x87de, 0xa438, 0xfc04, + 0xa438, 0xf8f9, 0xa438, 0xef79, 0xa438, 0xfbbf, 0xa438, 0x87f7, + 0xa438, 0x0278, 0xa438, 0x385c, 0xa438, 0x2000, 0xa438, 0x0d4d, + 0xa438, 0xa101, 0xa438, 0x51bf, 0xa438, 0x87f7, 0xa438, 0x0278, + 0xa438, 0x385c, 0xa438, 0x07ff, 0xa438, 0xe38f, 0xa438, 0x9d1b, + 0xa438, 0x319f, 0xa438, 0x410d, 0xa438, 0x48e3, 0xa438, 0x8f9e, + 0xa438, 0x1b31, 0xa438, 0x9f38, 0xa438, 0xbf87, 0xa438, 0xfa02, + 0xa438, 0x7838, 0xa438, 0x5c07, 0xa438, 0xffe3, 0xa438, 0x8f9f, + 0xa438, 0x1b31, 0xa438, 0x9f28, 0xa438, 0x0d48, 0xa438, 0xe38f, + 0xa438, 0xa01b, 0xa438, 0x319f, 0xa438, 0x1fbf, 0xa438, 0x87fd, + 0xa438, 0x0278, 0xa438, 0x385c, 0xa438, 0x07ff, 0xa438, 0xe38f, + 0xa438, 0xa11b, 0xa438, 0x319f, 0xa438, 0x0f0d, 0xa438, 0x48e3, + 0xa438, 0x8fa2, 0xa438, 0x1b31, 0xa438, 0x9f06, 0xa438, 0xee8f, + 0xa438, 0x9c01, 0xa438, 0xae04, 0xa438, 0xee8f, 0xa438, 0x9c00, + 0xa438, 0xffef, 0xa438, 0x97fd, 0xa438, 0xfc04, 0xa438, 0xf8f9, + 0xa438, 0xef79, 0xa438, 0xfbbf, 0xa438, 0x87f7, 0xa438, 0x0278, + 0xa438, 0x385c, 0xa438, 0x2000, 0xa438, 0x0d4d, 0xa438, 0xa100, + 0xa438, 0x20bf, 0xa438, 0x87f7, 0xa438, 0x0278, 0xa438, 0x385c, + 0xa438, 0x0600, 0xa438, 0x0d49, 0xa438, 0xe38f, 0xa438, 0xa31b, + 0xa438, 0x319f, 0xa438, 0x0ebf, 0xa438, 0x8800, 0xa438, 0x0277, + 0xa438, 0xf6bf, 0xa438, 0x8806, 0xa438, 0x0277, 0xa438, 0xf6ae, + 0xa438, 0x0cbf, 0xa438, 0x8800, 0xa438, 0x0277, 0xa438, 0xedbf, + 0xa438, 0x8806, 0xa438, 0x0277, 0xa438, 0xedee, 0xa438, 0x8f9c, + 0xa438, 0x00ff, 0xa438, 0xef97, 0xa438, 0xfdfc, 0xa438, 0x04f8, + 0xa438, 0xf9ef, 0xa438, 0x79fb, 0xa438, 0xbf87, 0xa438, 0xf702, + 0xa438, 0x7838, 0xa438, 0x5c20, 0xa438, 0x000d, 0xa438, 0x4da1, + 0xa438, 0x014a, 0xa438, 0xbf87, 0xa438, 0xf702, 0xa438, 0x7838, + 0xa438, 0x5c07, 0xa438, 0xffe3, 0xa438, 0x8fa4, 0xa438, 0x1b31, + 0xa438, 0x9f3a, 0xa438, 0x0d48, 0xa438, 0xe38f, 0xa438, 0xa51b, + 0xa438, 0x319f, 0xa438, 0x31bf, 0xa438, 0x87fa, 0xa438, 0x0278, + 0xa438, 0x38e3, 0xa438, 0x8fa6, 0xa438, 0x1b31, 0xa438, 0x9f24, + 0xa438, 0x0d48, 0xa438, 0xe38f, 0xa438, 0xa71b, 0xa438, 0x319f, + 0xa438, 0x1bbf, 0xa438, 0x87fd, 0xa438, 0x0278, 0xa438, 0x38e3, + 0xa438, 0x8fa8, 0xa438, 0x1b31, 0xa438, 0x9f0e, 0xa438, 0xbf88, + 0xa438, 0x0302, 0xa438, 0x77f6, 0xa438, 0xbf88, 0xa438, 0x0902, + 0xa438, 0x77f6, 0xa438, 0xae00, 0xa438, 0xffef, 0xa438, 0x97fd, + 0xa438, 0xfc04, 0xa438, 0xf8ef, 0xa438, 0x79fb, 0xa438, 0xe080, + 0xa438, 0x18ad, 0xa438, 0x261c, 0xa438, 0xee8f, 0xa438, 0x9c00, + 0xa438, 0xbf88, 0xa438, 0x0002, 0xa438, 0x77ed, 0xa438, 0xbf88, + 0xa438, 0x0602, 0xa438, 0x77ed, 0xa438, 0xbf88, 0xa438, 0x0302, + 0xa438, 0x77ed, 0xa438, 0xbf88, 0xa438, 0x0902, 0xa438, 0x77ed, + 0xa438, 0xffef, 0xa438, 0x97fc, 0xa438, 0x04f8, 0xa438, 0xe080, + 0xa438, 0x40f6, 0xa438, 0x25e4, 0xa438, 0x8040, 0xa438, 0xfc04, + 0xa438, 0xf8e0, 0xa438, 0x804c, 0xa438, 0xf625, 0xa438, 0xe480, + 0xa438, 0x4cfc, 0xa438, 0x0455, 0xa438, 0xa4ba, 0xa438, 0xf0a6, + 0xa438, 0x4af0, 0xa438, 0xa64c, 0xa438, 0xf0a6, 0xa438, 0x4e66, + 0xa438, 0xa4b6, 0xa438, 0x55a4, 0xa438, 0xb600, 0xa438, 0xac56, + 0xa438, 0x11ac, 0xa438, 0x56ee, 0xa438, 0x804c, 0xa438, 0x3aaf, + 0xa438, 0x0627, 0xa438, 0xbf88, 0xa438, 0x4802, 0xa438, 0x77ed, + 0xa438, 0xd203, 0xa438, 0xe083, 0xa438, 0x8a0d, 0xa438, 0x01f6, + 0xa438, 0x271b, 0xa438, 0x03aa, 0xa438, 0x0182, 0xa438, 0xe083, + 0xa438, 0x890d, 0xa438, 0x01f6, 0xa438, 0x271b, 0xa438, 0x03aa, + 0xa438, 0x0182, 0xa438, 0xe083, 0xa438, 0x880d, 0xa438, 0x01f6, + 0xa438, 0x271b, 0xa438, 0x03aa, 0xa438, 0x0782, 0xa438, 0xbf88, + 0xa438, 0x4802, 0xa438, 0x77f6, 0xa438, 0xaf16, 0xa438, 0x1500, + 0xa438, 0xa86a, 0xa436, 0xb818, 0xa438, 0x1D84, 0xa436, 0xb81a, + 0xa438, 0x1060, 0xa436, 0xb81c, 0xa438, 0x0623, 0xa436, 0xb81e, + 0xa438, 0x15ef, 0xa436, 0xb850, 0xa438, 0xffff, 0xa436, 0xb852, + 0xa438, 0xffff, 0xa436, 0xb878, 0xa438, 0xffff, 0xa436, 0xb884, + 0xa438, 0xffff, 0xa436, 0xb832, 0xa438, 0x000f, 0xa436, 0x0000, + 0xa438, 0x0000, 0xB82E, 0x0000, 0xa436, 0x8023, 0xa438, 0x0000, + 0xB820, 0x0000, 0xFFFF, 0xFFFF +}; static void -rtl8125_set_phy_mcu_8125b_1(struct net_device *dev) +rtl8126_real_set_phy_mcu_8126a_1_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_8126a_1_1(struct net_device *dev) -{ - rtl8125_set_phy_mcu_ram_code(dev, + rtl8126_set_phy_mcu_ram_code(dev, phy_mcu_ram_code_8126a_1_1, - ARRAY_SIZE(phy_mcu_ram_code_8126a_1_1) - ); + ARRAY_SIZE(phy_mcu_ram_code_8126a_1_1)); } static void -rtl8125_real_set_phy_mcu_8126a_1_2(struct net_device *dev) +rtl8126_real_set_phy_mcu_8126a_1_2(struct net_device *dev) { - rtl8125_set_phy_mcu_ram_code(dev, + rtl8126_set_phy_mcu_ram_code(dev, phy_mcu_ram_code_8126a_1_2, - ARRAY_SIZE(phy_mcu_ram_code_8126a_1_2) - ); + ARRAY_SIZE(phy_mcu_ram_code_8126a_1_2)); } static void -rtl8125_real_set_phy_mcu_8126a_1_3(struct net_device *dev) +rtl8126_real_set_phy_mcu_8126a_1_3(struct net_device *dev) { - rtl8125_set_phy_mcu_ram_code(dev, + rtl8126_set_phy_mcu_ram_code(dev, phy_mcu_ram_code_8126a_1_3, - ARRAY_SIZE(phy_mcu_ram_code_8126a_1_3) - ); + ARRAY_SIZE(phy_mcu_ram_code_8126a_1_3)); } static void -rtl8125_set_phy_mcu_8126a_1(struct net_device *dev) +rtl8126_set_phy_mcu_8126a_1(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - rtl8125_set_phy_mcu_patch_request(tp); + rtl8126_set_phy_mcu_patch_request(tp); - rtl8125_real_set_phy_mcu_8126a_1_1(dev); + rtl8126_real_set_phy_mcu_8126a_1_1(dev); - rtl8125_clear_phy_mcu_patch_request(tp); + rtl8126_clear_phy_mcu_patch_request(tp); - rtl8125_set_phy_mcu_patch_request(tp); + rtl8126_set_phy_mcu_patch_request(tp); - rtl8125_real_set_phy_mcu_8126a_1_2(dev); + rtl8126_real_set_phy_mcu_8126a_1_2(dev); - rtl8125_clear_phy_mcu_patch_request(tp); + rtl8126_clear_phy_mcu_patch_request(tp); - rtl8125_set_phy_mcu_patch_request(tp); + rtl8126_set_phy_mcu_patch_request(tp); - rtl8125_real_set_phy_mcu_8126a_1_3(dev); + rtl8126_real_set_phy_mcu_8126a_1_3(dev); - rtl8125_clear_phy_mcu_patch_request(tp); + rtl8126_clear_phy_mcu_patch_request(tp); } static void -rtl8125_real_set_phy_mcu_8126a_2_1(struct net_device *dev) +rtl8126_real_set_phy_mcu_8126a_2_1(struct net_device *dev) { - rtl8125_set_phy_mcu_ram_code(dev, + rtl8126_set_phy_mcu_ram_code(dev, phy_mcu_ram_code_8126a_2_1, - ARRAY_SIZE(phy_mcu_ram_code_8126a_2_1) - ); + ARRAY_SIZE(phy_mcu_ram_code_8126a_2_1)); } static void -rtl8125_real_set_phy_mcu_8126a_2_3(struct net_device *dev) +rtl8126_real_set_phy_mcu_8126a_2_3(struct net_device *dev) { - rtl8125_set_phy_mcu_ram_code(dev, + rtl8126_set_phy_mcu_ram_code(dev, phy_mcu_ram_code_8126a_2_3, - ARRAY_SIZE(phy_mcu_ram_code_8126a_2_3) - ); + ARRAY_SIZE(phy_mcu_ram_code_8126a_2_3)); } static void -rtl8125_set_phy_mcu_8126a_2(struct net_device *dev) +rtl8126_set_phy_mcu_8126a_2(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - rtl8125_set_phy_mcu_patch_request(tp); + rtl8126_set_phy_mcu_patch_request(tp); - rtl8125_real_set_phy_mcu_8126a_2_1(dev); + rtl8126_real_set_phy_mcu_8126a_2_1(dev); - rtl8125_clear_phy_mcu_patch_request(tp); + rtl8126_clear_phy_mcu_patch_request(tp); - rtl8125_set_phy_mcu_patch_request(tp); + rtl8126_set_phy_mcu_patch_request(tp); - rtl8125_real_set_phy_mcu_8126a_2_3(dev); + rtl8126_real_set_phy_mcu_8126a_2_3(dev); - rtl8125_clear_phy_mcu_patch_request(tp); + rtl8126_clear_phy_mcu_patch_request(tp); } static void -rtl8125_init_hw_phy_mcu(struct net_device *dev) +rtl8126_real_set_phy_mcu_8126a_3_1(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + rtl8126_set_phy_mcu_ram_code(dev, + phy_mcu_ram_code_8126a_3_1, + ARRAY_SIZE(phy_mcu_ram_code_8126a_3_1)); +} + +static void +rtl8126_set_phy_mcu_8126a_3(struct net_device *dev) +{ + struct rtl8126_private *tp = netdev_priv(dev); + + rtl8126_set_phy_mcu_patch_request(tp); + + rtl8126_real_set_phy_mcu_8126a_3_1(dev); + + rtl8126_clear_phy_mcu_patch_request(tp); +} + +static void +rtl8126_init_hw_phy_mcu(struct net_device *dev) +{ + struct rtl8126_private *tp = netdev_priv(dev); u8 require_disable_phy_disable_mode = FALSE; - if (tp->NotWrRamCodeToMicroP == TRUE) return; - if (rtl8125_check_hw_phy_mcu_code_ver(dev)) return; + if (tp->NotWrRamCodeToMicroP == TRUE) + return; - if (HW_SUPPORT_CHECK_PHY_DISABLE_MODE(tp) && rtl8125_is_in_phy_disable_mode(dev)) + if (rtl8126_check_hw_phy_mcu_code_ver(dev)) + return; + + if (HW_SUPPORT_CHECK_PHY_DISABLE_MODE(tp) && rtl8126_is_in_phy_disable_mode(dev)) require_disable_phy_disable_mode = TRUE; if (require_disable_phy_disable_mode) - rtl8125_disable_phy_disable_mode(dev); + rtl8126_disable_phy_disable_mode(dev); switch (tp->mcfg) { + case CFG_METHOD_1: + rtl8126_set_phy_mcu_8126a_1(dev); + break; case CFG_METHOD_2: - rtl8125_set_phy_mcu_8125a_1(dev); + rtl8126_set_phy_mcu_8126a_2(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_8126a_1(dev); - break; - case CFG_METHOD_9: - rtl8125_set_phy_mcu_8126a_2(dev); - break; - case CFG_METHOD_10: + rtl8126_set_phy_mcu_8126a_3(dev); break; } if (require_disable_phy_disable_mode) - rtl8125_enable_phy_disable_mode(dev); + rtl8126_enable_phy_disable_mode(dev); - rtl8125_write_hw_phy_mcu_code_ver(dev); + rtl8126_write_hw_phy_mcu_code_ver(dev); - rtl8125_mdio_write(tp,0x1F, 0x0000); + rtl8126_mdio_write(tp,0x1F, 0x0000); tp->HwHasWrRamCodeToMicroP = TRUE; } #endif static void -rtl8125_enable_phy_aldps(struct rtl8125_private *tp) +rtl8126_enable_phy_aldps(struct rtl8126_private *tp) { //enable aldps //GPHY OCP 0xA430 bit[2] = 0x1 (en_aldps) - rtl8125_set_eth_phy_ocp_bit(tp, 0xA430, BIT_2); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA430, BIT_2); } static void -rtl8125_hw_phy_config_8125a_1(struct net_device *dev) +rtl8126_hw_phy_config_8126a_1(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xAD40, - 0x03FF, - 0x84 - ); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - 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); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EA); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xC400 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80EB); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0x0700, - 0x0300 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80F8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x1C00 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80F1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x3000 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80FE); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xA500 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8102); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8105); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x3300 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8100); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x7000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8104); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xF000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8106); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x6500 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DC); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0xED00 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80DF); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_8); - 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 - ); - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x819F); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xD0B6); - - 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); - - //enable aldps - //GPHY OCP 0xA430 bit[2] = 0x1 (en_aldps) if (aspm) { if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); + rtl8126_enable_phy_aldps(tp); } } } static void -rtl8125_hw_phy_config_8125a_2(struct net_device *dev) +rtl8126_hw_phy_config_8126a_2(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_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 - ); - mdio_direct_write_phy_ocp(tp, 0xAD4C, 0x00A8); - 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 - ); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8157); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0500 - ); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8159); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xB87E, - 0xFF00, - 0x0700 - ); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - 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); - - 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); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xB896, BIT_0); - - rtl8125_clear_phy_mcu_patch_request(tp); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xD068, BIT_13); - - - 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); - - - rtl8125_clear_eth_phy_ocp_bit(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); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - if (tp->RequirePhyMdiSwapPatch) { - u16 adccal_offset_p0; - u16 adccal_offset_p1; - u16 adccal_offset_p2; - u16 adccal_offset_p3; - u16 rg_lpf_cap_xg_p0; - u16 rg_lpf_cap_xg_p1; - u16 rg_lpf_cap_xg_p2; - u16 rg_lpf_cap_xg_p3; - u16 rg_lpf_cap_p0; - u16 rg_lpf_cap_p1; - u16 rg_lpf_cap_p2; - u16 rg_lpf_cap_p3; - - 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 = 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 = 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 = 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 = 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 = mdio_direct_read_phy_ocp(tp, 0xBD5A); - rg_lpf_cap_xg_p0 &= 0x001F; - rg_lpf_cap_xg_p1 = mdio_direct_read_phy_ocp(tp, 0xBD5A); - rg_lpf_cap_xg_p1 &= 0x1F00; - rg_lpf_cap_xg_p2 = mdio_direct_read_phy_ocp(tp, 0xBD5C); - rg_lpf_cap_xg_p2 &= 0x001F; - rg_lpf_cap_xg_p3 = mdio_direct_read_phy_ocp(tp, 0xBD5C); - rg_lpf_cap_xg_p3 &= 0x1F00; - rg_lpf_cap_p0 = mdio_direct_read_phy_ocp(tp, 0xBC18); - rg_lpf_cap_p0 &= 0x001F; - rg_lpf_cap_p1 = mdio_direct_read_phy_ocp(tp, 0xBC18); - rg_lpf_cap_p1 &= 0x1F00; - rg_lpf_cap_p2 = mdio_direct_read_phy_ocp(tp, 0xBC1A); - rg_lpf_cap_p2 &= 0x001F; - rg_lpf_cap_p3 = mdio_direct_read_phy_ocp(tp, 0xBC1A); - rg_lpf_cap_p3 &= 0x1F00; - - - 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) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8125b_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - rtl8125_set_eth_phy_ocp_bit(tp, 0xBC08, (BIT_3 | BIT_2)); - - - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FFF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x0400 - ); - } - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8560); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8562); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8564); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x19CC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8566); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8568); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x856A); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x147D); - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFE); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0907); - } - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xACDA, - 0xFF00, - 0xFF00 - ); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_set_eth_phy_ocp_bit(tp, 0xBF4C, BIT_1); - rtl8125_set_eth_phy_ocp_bit(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); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA432, BIT_6); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8529); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x050E); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x816C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xC4A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8170); - mdio_direct_write_phy_ocp(tp, 0xA438, 0xC4A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8174); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x04A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8178); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x04A0); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x817C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0719); - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF4); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0400); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FF1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0404); - } - mdio_direct_write_phy_ocp(tp, 0xBF4A, 0x001B); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8033); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8037); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803B); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xFC32); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803F); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8043); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8047); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C13); - - - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8145); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x370E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8157); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x770E); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8169); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0D0A); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x817B); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x1D0A); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8217); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, - 0xA438, - 0xFF00, - 0x5000 - ); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x821A); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - rtl8125_clear_and_set_eth_phy_ocp_bit(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); - - 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); - - rtl8125_set_eth_phy_ocp_bit(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); - - - 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); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBFA4, BIT_5); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x817D); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_12); - - - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8125b_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - 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 - ); - - - 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); - 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 - ); - 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); - - - 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 - ); - - - 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); - - /* - 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); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBFA4, BIT_5); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x817D); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_12); - */ - - - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8126a_1(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); - } - } -} - -static void -rtl8125_hw_phy_config_8126a_2(struct net_device *dev) -{ - struct rtl8125_private *tp = netdev_priv(dev); - - rtl8125_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - - - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80BF); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0xED00); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CD); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80CD); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0x1000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D1); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D1); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0xC800); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D4); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80D4); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0xC800); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E1); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x10CC); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E5); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x4F0C); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x10CC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x80E5); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x4F0C); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8387); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8387); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0x4700); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA80C, BIT_7 | BIT_6, BIT_7); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC90, BIT_4); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAD2C, BIT_15); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8321); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_eth_phy_ocp_bit(tp, 0xAC90, BIT_4); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xAD2C, BIT_15); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8321); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x1100); - rtl8125_set_eth_phy_ocp_bit(tp, 0xACF8, (BIT_3 | BIT_2)); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8183); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_set_eth_phy_ocp_bit(tp, 0xACF8, (BIT_3 | BIT_2)); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8183); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0x5900); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD94, BIT_5); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA654, BIT_11); - rtl8125_set_eth_phy_ocp_bit(tp, 0xB648, BIT_14); + rtl8126_set_eth_phy_ocp_bit(tp, 0xAD94, BIT_5); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA654, BIT_11); + rtl8126_set_eth_phy_ocp_bit(tp, 0xB648, BIT_14); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x839E); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x839E); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x2F00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83F2); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83F2); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0800); - rtl8125_set_eth_phy_ocp_bit(tp, 0xADA0, BIT_1); + rtl8126_set_eth_phy_ocp_bit(tp, 0xADA0, BIT_1); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F3); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80F3); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x9900); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8126); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8126); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0xC100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x893A); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x8080); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8647); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x893A); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x8080); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8647); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0xE600); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x862C); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x862C); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x1200); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x864A); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x864A); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0xE600); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80A0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xBCBC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x805E); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0xBCBC); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8056); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3077); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8058); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80A0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xBCBC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x805E); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0xBCBC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8056); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3077); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8058); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x5A00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8098); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3077); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x809A); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8098); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3077); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x809A); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x5A00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8052); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3733); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8094); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3733); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x807F); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C75); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803D); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C75); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8036); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8052); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3733); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8094); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x3733); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x807F); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C75); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x803D); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x7C75); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8036); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x3000); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8078); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8078); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x3000); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8031); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8031); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x3300); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8073); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8073); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x3300); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xAE06, 0xFC00, 0x7C00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89D1); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0004); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FBD); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89D1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0004); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FBD); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0x0A00); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FBE); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0D09); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89CD); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F0F); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89CF); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F0F); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FBE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0D09); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89CD); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F0F); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89CF); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0F0F); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83A4); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83A6); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83C0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83C2); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8414); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8416); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83F8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83FA); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83A4); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83A6); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83C0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83C2); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8414); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8416); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83F8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6600); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x83FA); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x6601); - rtl8125_set_phy_mcu_patch_request(tp); + rtl8126_set_phy_mcu_patch_request(tp); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xBD96, 0x1F00, 0x1000); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xBF1C, 0x0007, 0x0007); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBFBE, BIT_15); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_eth_phy_ocp_bit(tp, 0xBFBE, BIT_15); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xBF40, 0x0380, 0x0280); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xBF90, BIT_7, (BIT_6 | BIT_5)); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xBF90, BIT_4, BIT_3 | BIT_2); - rtl8125_clear_phy_mcu_patch_request(tp); + rtl8126_clear_phy_mcu_patch_request(tp); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x843B); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x843B); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0x2000); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x843D); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x843D); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xA438, 0xFF00, 0x2000); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xB516, 0x7F); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xB516, 0x7F); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xBF80, (BIT_5 | BIT_4)); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xBF80, (BIT_5 | BIT_4)); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8188); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0044); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00A8); - 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, 0x00FC); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FE); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FE); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x00BC); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x0058); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x002A); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8188); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0044); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00A8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00D6); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00EC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00F6); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00BC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0058); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x002A); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8015); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8015); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0800); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFD); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFD); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0000); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFF); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x7F00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFB); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFB); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE9); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0002); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FEF); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x00A5); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FF1); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0106); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE9); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0002); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FEF); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x00A5); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FF1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0106); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE1); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0102); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE3); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0102); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE3); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0400); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA654, BIT_11); - rtl8125_clear_eth_phy_ocp_bit(tp, 0XA65A, (BIT_1 | BIT_0)); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA654, BIT_11); + rtl8126_clear_eth_phy_ocp_bit(tp, 0XA65A, (BIT_1 | BIT_0)); - mdio_direct_write_phy_ocp(tp, 0xAC3A, 0x5851); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xAC3A, 0x5851); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0XAC3C, BIT_15 | BIT_14 | BIT_12, BIT_13); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xAC42, BIT_9, BIT_8 | BIT_7 | BIT_6); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC3E, BIT_15 | BIT_14 | BIT_13); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAC42, BIT_5 | BIT_4 | BIT_3); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_clear_eth_phy_ocp_bit(tp, 0xAC3E, BIT_15 | BIT_14 | BIT_13); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xAC42, BIT_5 | BIT_4 | BIT_3); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xAC42, BIT_1, BIT_2 | BIT_0); - mdio_direct_write_phy_ocp(tp, 0xAC1A, 0x00DB); - mdio_direct_write_phy_ocp(tp, 0xADE4, 0x01B5); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAD9C, BIT_11 | BIT_10); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xAC1A, 0x00DB); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xADE4, 0x01B5); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xAD9C, BIT_11 | BIT_10); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814B); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814B); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x1100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814D); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814D); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x1100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814F); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814F); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0B00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8142); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8142); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8144); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8144); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8150); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8150); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8118); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8118); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0700); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811A); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811A); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0700); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811C); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811C); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0500); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x810F); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x810F); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8111); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8111); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811D); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811D); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0100); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAC36, BIT_12); - rtl8125_clear_eth_phy_ocp_bit(tp, 0xAD1C, BIT_8); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_set_eth_phy_ocp_bit(tp, 0xAC36, BIT_12); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xAD1C, BIT_8); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xADE8, 0xFFC0, 0x1400); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x864B); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x864B); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x9D00); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8F97); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x003F); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3F02); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x023C); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x3B0A); - mdio_direct_write_phy_ocp(tp, 0xA438, 0x1C00); - 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); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8F97); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x003F); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3F02); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x023C); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3B0A); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1C00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); - rtl8125_set_eth_phy_ocp_bit(tp, 0xAD9C, BIT_5); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8122); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_set_eth_phy_ocp_bit(tp, 0xAD9C, BIT_5); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8122); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0C00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x82C8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FF); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0009); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000B); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0021); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F7); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03B8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0049); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0049); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03B8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F7); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0021); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000B); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0009); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FF); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x82C8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FF); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0009); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000B); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0021); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F7); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03B8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0049); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0049); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03B8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F7); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0021); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000B); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0009); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FF); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80EF); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80EF); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0C00); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x82A0); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000E); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0006); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x001A); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F1); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03D8); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0023); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0054); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0322); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x00DD); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03AB); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03DC); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0027); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000E); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E5); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F9); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0012); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0001); - mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x82A0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000E); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0006); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x001A); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03D8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0023); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0054); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0322); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x00DD); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03AB); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03DC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0027); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000E); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E5); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F9); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0012); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0001); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F1); - mdio_direct_write_phy_ocp(tp, 0xA436, 0x8018); - rtl8125_set_eth_phy_ocp_bit(tp, 0xA438, BIT_13); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8018); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA438, BIT_13); - mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE4); - rtl8125_clear_and_set_eth_phy_ocp_bit(tp, + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FE4); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00, 0x0000); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB54C, + 0xFFC0, + 0x3700); + + if (aspm) { if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); + rtl8126_enable_phy_aldps(tp); } } } static void -rtl8125_hw_phy_config_8126a_3(struct net_device *dev) +rtl8126_hw_phy_config_8126a_3(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); + + rtl8126_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); + + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8183); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xA438, + 0xFF00, + 0x5900); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA654, BIT_11); + rtl8126_set_eth_phy_ocp_bit(tp, 0xB648, BIT_14); + rtl8126_set_eth_phy_ocp_bit(tp, 0xAD2C, BIT_15); + rtl8126_set_eth_phy_ocp_bit(tp, 0xAD94, BIT_5); + rtl8126_set_eth_phy_ocp_bit(tp, 0xADA0, BIT_1); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xAE06, + BIT_15 | BIT_14 | BIT_13 | BIT_12 | BIT_11 | BIT_10, + BIT_14 | BIT_13 | BIT_12 | BIT_11 | BIT_10); + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8647); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0xE600); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8036); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x3000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8078); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x3000); + + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x89E9); + rtl8126_set_eth_phy_ocp_bit(tp, 0xB87E, 0xFF00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFD); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFE); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0200); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8FFF); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0400); + + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8018); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xA438, + 0xFF00, + 0x7700); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8F9C); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0005); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x00ED); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0502); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0B00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0xD401); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8FA8); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xA438, + 0xFF00, + 0x2900); + + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814B); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x1100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814D); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x1100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x814F); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0B00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8142); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8144); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8150); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8118); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0700); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811A); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0700); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811C); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0500); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x810F); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8111); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x811D); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0100); + + + rtl8126_set_eth_phy_ocp_bit(tp, 0xAD1C, BIT_8); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xADE8, + BIT_15 | BIT_14 | BIT_13 | BIT_12 | BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6, + BIT_12 | BIT_10); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x864B); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x9D00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x862C); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x1200); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA436, 0x8566); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x003F); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3F02); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x023C); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x3B0A); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x1C00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xA438, 0x0000); + + + rtl8126_set_eth_phy_ocp_bit(tp, 0xAD9C, BIT_5); + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8122); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0C00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x82C8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FF); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0009); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000B); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0021); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F7); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03B8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0049); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0049); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03B8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F7); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0021); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000B); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0009); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FF); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x80EF); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x0C00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x82A0); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000E); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03FE); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03ED); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0006); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x001A); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F1); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03D8); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0023); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0054); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0322); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x00DD); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03AB); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03DC); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0027); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x000E); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03E5); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F9); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0012); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x0001); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87E, 0x03F1); + + + rtl8126_set_eth_phy_ocp_bit(tp, 0xA430, BIT_1 | BIT_0); + + + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB54C, + 0xFFC0, + 0x3700); if (aspm) { if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8125_enable_phy_aldps(tp); + rtl8126_enable_phy_aldps(tp); } } } static void -rtl8125_hw_phy_config(struct net_device *dev) +rtl8126_hw_phy_config(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (tp->resume_not_chg_speed) return; + if (tp->resume_not_chg_speed) + return; tp->phy_reset_enable(dev); - if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) return; + if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) + return; #ifndef ENABLE_USE_FIRMWARE_FILE - if (!tp->rtl_fw) { - rtl8125_set_hw_phy_before_init_phy_mcu(dev); - - rtl8125_init_hw_phy_mcu(dev); - } + if (!tp->rtl_fw) + rtl8126_init_hw_phy_mcu(dev); #endif switch (tp->mcfg) { + case CFG_METHOD_1: + rtl8126_hw_phy_config_8126a_1(dev); + break; case CFG_METHOD_2: - rtl8125_hw_phy_config_8125a_1(dev); + rtl8126_hw_phy_config_8126a_2(dev); break; case CFG_METHOD_3: - case CFG_METHOD_6: - rtl8125_hw_phy_config_8125a_2(dev); - break; - case CFG_METHOD_4: - rtl8125_hw_phy_config_8125b_1(dev); - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - rtl8125_hw_phy_config_8125b_2(dev); - break; - case CFG_METHOD_8: - rtl8125_hw_phy_config_8126a_1(dev); - break; - case CFG_METHOD_9: - rtl8125_hw_phy_config_8126a_2(dev); - break; - case CFG_METHOD_10: - rtl8125_hw_phy_config_8126a_3(dev); + rtl8126_hw_phy_config_8126a_3(dev); break; } //legacy force mode(Chap 22) switch (tp->mcfg) { + case CFG_METHOD_1: 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: default: - rtl8125_clear_eth_phy_ocp_bit(tp, 0xA5B4, BIT_15); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA5B4, BIT_15); break; } - /*ocp phy power saving*/ - /* - if (aspm) { - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6) - rtl8125_enable_ocp_phy_power_saving(dev); - } - */ - - rtl8125_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, 0x1F, 0x0000); if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { if (tp->eee.eee_enabled) - rtl8125_enable_eee(tp); + rtl8126_enable_eee(tp); else - rtl8125_disable_eee(tp); + rtl8126_disable_eee(tp); } } static void -rtl8125_up(struct net_device *dev) +rtl8126_up(struct net_device *dev) { - rtl8125_hw_init(dev); - rtl8125_hw_reset(dev); - rtl8125_powerup_pll(dev); - rtl8125_hw_ephy_config(dev); - rtl8125_hw_phy_config(dev); - rtl8125_hw_config(dev); + rtl8126_hw_init(dev); + rtl8126_hw_reset(dev); + rtl8126_powerup_pll(dev); + rtl8126_hw_ephy_config(dev); + rtl8126_hw_phy_config(dev); + rtl8126_hw_config(dev); } /* -static inline void rtl8125_delete_esd_timer(struct net_device *dev, struct timer_list *timer) +static inline void rtl8126_delete_esd_timer(struct net_device *dev, struct timer_list *timer) { del_timer_sync(timer); } -static inline void rtl8125_request_esd_timer(struct net_device *dev) +static inline void rtl8126_request_esd_timer(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct timer_list *timer = &tp->esd_timer; #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - setup_timer(timer, rtl8125_esd_timer, (unsigned long)dev); + setup_timer(timer, rtl8126_esd_timer, (unsigned long)dev); #else - timer_setup(timer, rtl8125_esd_timer, 0); + timer_setup(timer, rtl8126_esd_timer, 0); #endif - mod_timer(timer, jiffies + RTL8125_ESD_TIMEOUT); + mod_timer(timer, jiffies + RTL8126_ESD_TIMEOUT); } */ /* -static inline void rtl8125_delete_link_timer(struct net_device *dev, struct timer_list *timer) +static inline void rtl8126_delete_link_timer(struct net_device *dev, struct timer_list *timer) { del_timer_sync(timer); } -static inline void rtl8125_request_link_timer(struct net_device *dev) +static inline void rtl8126_request_link_timer(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct timer_list *timer = &tp->link_timer; #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) - setup_timer(timer, rtl8125_link_timer, (unsigned long)dev); + setup_timer(timer, rtl8126_link_timer, (unsigned long)dev); #else - timer_setup(timer, rtl8125_link_timer, 0); + timer_setup(timer, rtl8126_link_timer, 0); #endif - mod_timer(timer, jiffies + RTL8125_LINK_TIMEOUT); + mod_timer(timer, jiffies + RTL8126_LINK_TIMEOUT); } */ @@ -14757,22 +11492,22 @@ static inline void rtl8125_request_link_timer(struct net_device *dev) * the interrupt routine is executing. */ static void -rtl8125_netpoll(struct net_device *dev) +rtl8126_netpoll(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; for (i = 0; i < tp->irq_nvecs; i++) { - struct r8125_irq *irq = &tp->irq_tbl[i]; - struct r8125_napi *r8125napi = &tp->r8125napi[i]; + struct r8126_irq *irq = &tp->irq_tbl[i]; + struct r8126_napi *r8126napi = &tp->r8126napi[i]; disable_irq(irq->vector); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0) - irq->handler(irq->vector, r8125napi); + irq->handler(irq->vector, r8126napi); #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) - irq->handler(irq->vector, r8125napi, NULL); + irq->handler(irq->vector, r8126napi, NULL); #else - irq->handler(irq->vector, r8125napi); + irq->handler(irq->vector, r8126napi); #endif enable_irq(irq->vector); @@ -14781,47 +11516,104 @@ rtl8125_netpoll(struct net_device *dev) #endif //CONFIG_NET_POLL_CONTROLLER static void -rtl8125_setup_mqs_reg(struct rtl8125_private *tp) +rtl8126_setup_interrupt_mask(struct rtl8126_private *tp) { int i; + 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 < 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; + + 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 + } +} + +static void +rtl8126_setup_mqs_reg(struct rtl8126_private *tp) +{ + u16 hw_clo_ptr0_reg, sw_tail_ptr0_reg; + u16 reg_len; + int i; + //tx tp->tx_ring[0].tdsar_reg = TxDescStartAddrLow; - for (i = 1; i < R8125_MAX_TX_QUEUES; i++) { + for (i = 1; i < R8126_MAX_TX_QUEUES; i++) { tp->tx_ring[i].tdsar_reg = (u16)(TNPDS_Q1_LOW_8125 + (i - 1) * 8); } - for (i = 0; i < R8125_MAX_TX_QUEUES; i++) { - if (tp->HwSuppTxNoCloseVer > 3) { - tp->tx_ring[i].hw_clo_ptr_reg = (u16)(HW_CLO_PTR0_8126 + i * 4); - tp->tx_ring[i].sw_tail_ptr_reg = (u16)(SW_TAIL_PTR0_8126 + i * 4); - } else { - 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); - } + 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 < R8126_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); } //rx tp->rx_ring[0].rdsar_reg = RxDescAddrLow; - for (i = 1; i < R8125_MAX_RX_QUEUES; i++) { + for (i = 1; i < R8126_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 < R8126_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 < R8126_MAX_QUEUES; i++) { tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4); } } static void -rtl8125_init_software_variable(struct net_device *dev) +rtl8126_init_software_variable(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct pci_dev *pdev = tp->pci_dev; #ifdef ENABLE_LIB_SUPPORT @@ -14829,26 +11621,17 @@ rtl8125_init_software_variable(struct net_device *dev) #endif switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - //tp->HwSuppDashVer = 3; - break; default: tp->HwSuppDashVer = 0; break; } + tp->AllowAccessDashOcp = rtl8126_is_allow_access_dash_ocp(tp); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - tp->HwPkgDet = rtl8125_mac_ocp_read(tp, 0xDC00); + tp->HwPkgDet = rtl8126_mac_ocp_read(tp, 0xDC00); tp->HwPkgDet = (tp->HwPkgDet >> 3) & 0x07; break; } @@ -14857,38 +11640,26 @@ rtl8125_init_software_variable(struct net_device *dev) eee_enable = 0; switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->HwSuppNowIsOobVer = 1; break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - tp->HwPcieSNOffset = 0x16C; + tp->HwPcieSNOffset = 0x174; break; } #ifdef ENABLE_REALWOW_SUPPORT - rtl8125_get_realwow_hw_version(dev); + rtl8126_get_realwow_hw_version(dev); #endif //ENABLE_REALWOW_SUPPORT - if (HW_DASH_SUPPORT_DASH(tp) && rtl8125_check_dash(tp)) + if (HW_DASH_SUPPORT_DASH(tp) && rtl8126_check_dash(tp)) tp->DASH = 1; else tp->DASH = 0; @@ -14899,14 +11670,14 @@ rtl8125_init_software_variable(struct net_device *dev) void __iomem *cmac_ioaddr = NULL; //map CMAC IO space - CmacMemPhysAddress = rtl8125_csi_other_fun_read(tp, 0, 0x18); + CmacMemPhysAddress = rtl8126_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 |= (u64)rtl8126_csi_other_fun_read(tp, 0, 0x1C) << 32; CmacMemPhysAddress &= 0xFFFFFFF0; /* ioremap MMIO region */ - cmac_ioaddr = ioremap(CmacMemPhysAddress, R8125_REGS_SIZE); + cmac_ioaddr = ioremap(CmacMemPhysAddress, R8126_REGS_SIZE); } if (cmac_ioaddr == NULL) { @@ -14931,35 +11702,19 @@ rtl8125_init_software_variable(struct net_device *dev) if (aspm) { switch (tp->mcfg) { + case CFG_METHOD_1: 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: - tp->org_pci_offset_99 = rtl8125_csi_fun0_read_byte(tp, 0x99); + tp->org_pci_offset_99 = rtl8126_csi_fun0_read_byte(tp, 0x99); tp->org_pci_offset_99 &= ~(BIT_5|BIT_6); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - tp->org_pci_offset_180 = rtl8125_csi_fun0_read_byte(tp, 0x22c); + tp->org_pci_offset_180 = rtl8126_csi_fun0_read_byte(tp, 0x22c); break; } } @@ -14968,34 +11723,20 @@ rtl8125_init_software_variable(struct net_device *dev) pci_read_config_byte(pdev, 0x81, &tp->org_pci_offset_81); switch (tp->mcfg) { + case CFG_METHOD_1: 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: default: tp->use_timer_interrupt = TRUE; break; } switch (tp->mcfg) { + case CFG_METHOD_1: case CFG_METHOD_2: case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - tp->HwSuppMaxPhyLinkSpeed = 2500; - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - tp->HwSuppMaxPhyLinkSpeed = 5000; - break; default: - tp->HwSuppMaxPhyLinkSpeed = 1000; + tp->HwSuppMaxPhyLinkSpeed = 5000; break; } @@ -15003,15 +11744,9 @@ rtl8125_init_software_variable(struct net_device *dev) tp->use_timer_interrupt = FALSE; switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->ShortPacketSwChecksum = TRUE; tp->UseSwPaddingShortPkt = TRUE; break; @@ -15020,15 +11755,9 @@ rtl8125_init_software_variable(struct net_device *dev) } switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->HwSuppMagicPktVer = WAKEUP_MAGIC_PACKET_V3; break; default: @@ -15037,108 +11766,68 @@ rtl8125_init_software_variable(struct net_device *dev) } switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->HwSuppLinkChgWakeUpVer = 3; break; } switch (tp->mcfg) { + case CFG_METHOD_1: + 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: tp->HwSuppD0SpeedUpVer = 1; break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->HwSuppCheckPhyDisableModeVer = 3; break; } switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_6: - case CFG_METHOD_7: - tp->HwSuppTxNoCloseVer = 3; - break; - case CFG_METHOD_8: + case CFG_METHOD_1: tp->HwSuppTxNoCloseVer = 4; break; - case CFG_METHOD_9: - case CFG_METHOD_10: + case CFG_METHOD_2: + case CFG_METHOD_3: tp->HwSuppTxNoCloseVer = 5; break; } - if (tp->HwSuppTxNoCloseVer == 5) + switch (tp->HwSuppTxNoCloseVer) { + case 5: + case 6: tp->MaxTxDescPtrMask = MAX_TX_NO_CLOSE_DESC_PTR_MASK_V4; - else if (tp->HwSuppTxNoCloseVer == 4) + break; + case 4: tp->MaxTxDescPtrMask = MAX_TX_NO_CLOSE_DESC_PTR_MASK_V3; - else if (tp->HwSuppTxNoCloseVer == 3) + break; + case 3: tp->MaxTxDescPtrMask = MAX_TX_NO_CLOSE_DESC_PTR_MASK_V2; - else + break; + default: tx_no_close_enable = 0; + break; + } if (tp->HwSuppTxNoCloseVer > 0 && tx_no_close_enable == 1) tp->EnableTxNoClose = TRUE; switch (tp->mcfg) { - case CFG_METHOD_2: - case CFG_METHOD_3: - case CFG_METHOD_6: - tp->RequireLSOPatch = TRUE; + case CFG_METHOD_1: + tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_1; break; - } - - switch (tp->mcfg) { case CFG_METHOD_2: tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_2; break; case CFG_METHOD_3: - case CFG_METHOD_6: tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_3; break; - case CFG_METHOD_4: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_4; - break; - case CFG_METHOD_5: - case CFG_METHOD_7: - tp->sw_ram_code_ver = NIC_RAMCODE_VERSION_CFG_METHOD_5; - break; - 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; } if (tp->HwIcVerUnknown) { @@ -15147,49 +11836,25 @@ rtl8125_init_software_variable(struct net_device *dev) } switch (tp->mcfg) { - case CFG_METHOD_3: - case CFG_METHOD_6: - if ((rtl8125_mac_ocp_read(tp, 0xD442) & BIT_5) && - (mdio_direct_read_phy_ocp(tp, 0xD068) & BIT_1)) - tp->RequirePhyMdiSwapPatch = TRUE; - break; - } - - switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->HwSuppMacMcuVer = 2; break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - tp->MacMcuPageSize = RTL8125_MAC_MCU_PAGE_SIZE; + tp->MacMcuPageSize = RTL8126_MAC_MCU_PAGE_SIZE; break; } 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_1: + case CFG_METHOD_2: + case CFG_METHOD_3: tp->HwSuppNumTxQueues = 2; tp->HwSuppNumRxQueues = 4; break; @@ -15199,13 +11864,6 @@ 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; @@ -15213,14 +11871,11 @@ rtl8125_init_software_variable(struct net_device *dev) //init interrupt switch (tp->mcfg) { - case CFG_METHOD_4: - case CFG_METHOD_5: - case CFG_METHOD_7: - case CFG_METHOD_8: + case CFG_METHOD_1: tp->HwSuppIsrVer = 2; break; - case CFG_METHOD_9: - case CFG_METHOD_10: + case CFG_METHOD_2: + case CFG_METHOD_3: tp->HwSuppIsrVer = 3; break; default: @@ -15247,12 +11902,9 @@ rtl8125_init_software_variable(struct net_device *dev) //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_1: + case CFG_METHOD_2: + case CFG_METHOD_3: tp->HwSuppRssVer = 5; tp->HwSuppIndirTblEntries = 128; break; @@ -15279,74 +11931,26 @@ rtl8125_init_software_variable(struct net_device *dev) #endif //interrupt mask - if (tp->HwCurrIsrVer == 3) { - int i; + rtl8126_setup_interrupt_mask(tp); - tp->intr_mask = ISRIMR_V2_LINKCHG; - for (i = 0; i < tp->num_rx_rings; i++) - tp->intr_mask |= ISRIMR_V2_ROK_Q0 << i; - } else if (tp->HwCurrIsrVer == 2) { - int i; + rtl8126_setup_mqs_reg(tp); - 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 - } - - rtl8125_setup_mqs_reg(tp); - - rtl8125_set_ring_size(tp, NUM_RX_DESC, NUM_TX_DESC); + rtl8126_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: - case CFG_METHOD_8: + case CFG_METHOD_1: tp->HwSuppIntMitiVer = 4; break; - case CFG_METHOD_9: - case CFG_METHOD_10: + case CFG_METHOD_2: + case CFG_METHOD_3: tp->HwSuppIntMitiVer = 5; break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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->HwSuppTcamVer = 1; - - tp->TcamNotValidReg = TCAM_NOTVALID_ADDR; - tp->TcamValidReg = TCAM_VALID_ADDR; - tp->TcamMaAddrcOffset = TCAM_MAC_ADDR; - tp->TcamVlanTagOffset = TCAM_VLAN_TAG; - break; - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: tp->HwSuppTcamVer = 2; tp->TcamNotValidReg = TCAM_NOTVALID_ADDR_V2; @@ -15357,15 +11961,9 @@ rtl8125_init_software_variable(struct net_device *dev) } switch (tp->mcfg) { + case CFG_METHOD_1: 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: tp->HwSuppExtendTallyCounterVer = 1; break; } @@ -15380,27 +11978,17 @@ rtl8125_init_software_variable(struct net_device *dev) 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; + tp->rtl8126_rx_config = rtl_chip_info[tp->chipset].RCR_Cfg; if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - tp->rtl8125_rx_config |= EnableRxDescV3; + tp->rtl8126_rx_config |= EnableRxDescV3; tp->NicCustLedValue = RTL_R16(tp, CustomLED); - tp->wol_opts = rtl8125_get_hw_wol(tp); + tp->wol_opts = rtl8126_get_hw_wol(tp); tp->wol_enabled = (tp->wol_opts) ? WOL_ENABLED : WOL_DISABLED; - if (HW_SUPP_PHY_LINK_SPEED_2500M(tp)) - rtl8125_link_option((u8*)&autoneg_mode, (u32*)&speed_mode, (u8*)&duplex_mode, (u32*)&advertising_mode); - else - rtl8125_link_option_giga((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; - if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) - tp->advertising |= RTK_ADVERTISED_5000baseX_Full; - tp->fcpause = rtl8125_fc_full; + rtl8126_set_link_option(tp, autoneg_mode, speed_mode, duplex_mode, + rtl8126_fc_full); tp->max_jumbo_frame_size = rtl_chip_info[tp->chipset].jumbo_frame_sz; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) @@ -15415,16 +12003,15 @@ rtl8125_init_software_variable(struct net_device *dev) eee->eee_enabled = eee_enable; 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_4: - case CFG_METHOD_5: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: - eee->supported |= SUPPORTED_2500baseX_Full; + default: + if (HW_SUPP_PHY_LINK_SPEED_2500M(tp)) { + eee->supported |= SUPPORTED_2500baseX_Full; + eee->advertised |= SUPPORTED_2500baseX_Full; + } break; } - eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX); eee->tx_lpi_enabled = eee_enable; eee->tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20; } @@ -15433,22 +12020,22 @@ rtl8125_init_software_variable(struct net_device *dev) #ifdef ENABLE_RSS_SUPPORT if (tp->EnableRss) - rtl8125_init_rss(tp); + rtl8126_init_rss(tp); #endif } static void -rtl8125_release_board(struct pci_dev *pdev, +rtl8126_release_board(struct pci_dev *pdev, struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); void __iomem *ioaddr = tp->mmio_addr; - rtl8125_rar_set(tp, tp->org_mac_addr); + rtl8126_rar_set(tp, tp->org_mac_addr); tp->wol_enabled = WOL_DISABLED; if (!tp->DASH) - rtl8125_phy_power_down(dev); + rtl8126_phy_power_down(dev); #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) @@ -15466,7 +12053,7 @@ rtl8125_release_board(struct pci_dev *pdev, } static void -rtl8125_hw_address_set(struct net_device *dev, u8 mac_addr[MAC_ADDR_LEN]) +rtl8126_hw_address_set(struct net_device *dev, u8 mac_addr[MAC_ADDR_LEN]) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) eth_hw_addr_set(dev, mac_addr); @@ -15476,27 +12063,23 @@ rtl8125_hw_address_set(struct net_device *dev, u8 mac_addr[MAC_ADDR_LEN]) } static int -rtl8125_get_mac_address(struct net_device *dev) +rtl8126_get_mac_address(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; u8 mac_addr[MAC_ADDR_LEN]; for (i = 0; i < MAC_ADDR_LEN; i++) mac_addr[i] = RTL_R8(tp, MAC0 + i); - if(tp->mcfg == CFG_METHOD_2 || - tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_4 || - tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_6 || - tp->mcfg == CFG_METHOD_7 || - tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) { + switch (tp->mcfg) { + case CFG_METHOD_1 ... CFG_METHOD_3: *(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", @@ -15508,8 +12091,8 @@ rtl8125_get_mac_address(struct net_device *dev) tp->random_mac = 1; } - rtl8125_hw_address_set(dev, mac_addr); - rtl8125_rar_set(tp, mac_addr); + rtl8126_hw_address_set(dev, mac_addr); + rtl8126_rar_set(tp, mac_addr); /* keep the original MAC address */ memcpy(tp->org_mac_addr, dev->dev_addr, MAC_ADDR_LEN); @@ -15520,37 +12103,37 @@ rtl8125_get_mac_address(struct net_device *dev) } /** - * rtl8125_set_mac_address - Change the Ethernet Address of the NIC + * rtl8126_set_mac_address - Change the Ethernet Address of the NIC * @dev: network interface device structure * @p: pointer to an address structure * * Return 0 on success, negative on failure **/ static int -rtl8125_set_mac_address(struct net_device *dev, +rtl8126_set_mac_address(struct net_device *dev, void *p) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct sockaddr *addr = p; if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - rtl8125_hw_address_set(dev, addr->sa_data); + rtl8126_hw_address_set(dev, addr->sa_data); - rtl8125_rar_set(tp, dev->dev_addr); + rtl8126_rar_set(tp, dev->dev_addr); return 0; } /****************************************************************************** - * rtl8125_rar_set - Puts an ethernet address into a receive address register. + * rtl8126_rar_set - Puts an ethernet address into a receive address register. * * tp - The private data structure for driver * addr - Address to put into receive address register *****************************************************************************/ void -rtl8125_rar_set(struct rtl8125_private *tp, +rtl8126_rar_set(struct rtl8126_private *tp, const u8 *addr) { uint32_t rar_low = 0; @@ -15564,11 +12147,11 @@ rtl8125_rar_set(struct rtl8125_private *tp, rar_high = ((uint32_t) addr[4] | ((uint32_t) addr[5] << 8)); - rtl8125_enable_cfg9346_write(tp); + rtl8126_enable_cfg9346_write(tp); RTL_W32(tp, MAC0, rar_low); RTL_W32(tp, MAC4, rar_high); - rtl8125_disable_cfg9346_write(tp); + rtl8126_disable_cfg9346_write(tp); } #ifdef ETHTOOL_OPS_COMPAT @@ -16232,10 +12815,10 @@ static int ethtool_ioctl(struct ifreq *ifr) #endif //ETHTOOL_OPS_COMPAT #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) -static int rtl8125_siocdevprivate(struct net_device *dev, struct ifreq *ifr, +static int rtl8126_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data, int cmd) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ret = 0; switch (cmd) { @@ -16250,7 +12833,7 @@ static int rtl8125_siocdevprivate(struct net_device *dev, struct ifreq *ifr, break; } - ret = rtl8125_dash_ioctl(dev, ifr); + ret = rtl8126_dash_ioctl(dev, ifr); break; #endif @@ -16261,7 +12844,7 @@ static int rtl8125_siocdevprivate(struct net_device *dev, struct ifreq *ifr, break; } - ret = rtl8125_realwow_ioctl(dev, ifr); + ret = rtl8126_realwow_ioctl(dev, ifr); break; #endif @@ -16271,7 +12854,7 @@ static int rtl8125_siocdevprivate(struct net_device *dev, struct ifreq *ifr, break; } - ret = rtl8125_tool_ioctl(tp, ifr); + ret = rtl8126_tool_ioctl(tp, ifr); break; default: @@ -16283,11 +12866,11 @@ static int rtl8125_siocdevprivate(struct net_device *dev, struct ifreq *ifr, #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) static int -rtl8125_do_ioctl(struct net_device *dev, +rtl8126_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct mii_ioctl_data *data = if_mii(ifr); int ret = 0; @@ -16297,15 +12880,15 @@ rtl8125_do_ioctl(struct net_device *dev, break; case SIOCGMIIREG: - rtl8125_mdio_write(tp, 0x1F, 0x0000); - data->val_out = rtl8125_mdio_read(tp, data->reg_num); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + data->val_out = rtl8126_mdio_read(tp, data->reg_num); break; case SIOCSMIIREG: if (!capable(CAP_NET_ADMIN)) return -EPERM; - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, data->reg_num, data->val_in); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, data->reg_num, data->val_in); break; #ifdef ETHTOOL_OPS_COMPAT @@ -16318,7 +12901,7 @@ rtl8125_do_ioctl(struct net_device *dev, case SIOCSHWTSTAMP: case SIOCGHWTSTAMP: if (tp->EnablePtp) - ret = rtl8125_ptp_ioctl(dev, ifr, cmd); + ret = rtl8126_ptp_ioctl(dev, ifr, cmd); else ret = -EOPNOTSUPP; break; @@ -16335,7 +12918,7 @@ rtl8125_do_ioctl(struct net_device *dev, break; } - ret = rtl8125_dash_ioctl(dev, ifr); + ret = rtl8126_dash_ioctl(dev, ifr); break; #endif @@ -16351,7 +12934,7 @@ rtl8125_do_ioctl(struct net_device *dev, break; } - ret = rtl8125_realwow_ioctl(dev, ifr); + ret = rtl8126_realwow_ioctl(dev, ifr); break; #endif @@ -16361,7 +12944,7 @@ rtl8125_do_ioctl(struct net_device *dev, break; } - ret = rtl8125_tool_ioctl(tp, ifr); + ret = rtl8126_tool_ioctl(tp, ifr); break; #endif //LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) @@ -16374,56 +12957,49 @@ rtl8125_do_ioctl(struct net_device *dev, } static void -rtl8125_phy_power_up(struct net_device *dev) +rtl8126_phy_power_up(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (rtl8125_is_in_phy_disable_mode(dev)) { + if (rtl8126_is_in_phy_disable_mode(dev)) return; - } - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, MII_BMCR, BMCR_ANENABLE); //wait ups resume (phy state 3) switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_wait_phy_ups_resume(dev, 3); + rtl8126_wait_phy_ups_resume(dev, 3); break; }; } static void -rtl8125_phy_power_down(struct net_device *dev) +rtl8126_phy_power_down(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - rtl8125_mdio_write(tp, 0x1F, 0x0000); - rtl8125_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN); + rtl8126_mdio_write(tp, 0x1F, 0x0000); + rtl8126_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN); } static int __devinit -rtl8125_init_board(struct pci_dev *pdev, +rtl8126_init_board(struct pci_dev *pdev, struct net_device **dev_out, void __iomem **ioaddr_out) { void __iomem *ioaddr; struct net_device *dev; - struct rtl8125_private *tp; + struct rtl8126_private *tp; int rc = -ENOMEM, i, pm_cap; assert(ioaddr_out != NULL); /* dev zeroed in alloc_etherdev */ - dev = alloc_etherdev_mq(sizeof (*tp), R8125_MAX_QUEUES); + dev = alloc_etherdev_mq(sizeof (*tp), R8126_MAX_QUEUES); if (dev == NULL) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) if (netif_msg_drv(&debug)) @@ -16437,7 +13013,7 @@ rtl8125_init_board(struct pci_dev *pdev, tp = netdev_priv(dev); tp->dev = dev; tp->pci_dev = pdev; - tp->msg_enable = netif_msg_init(debug.msg_enable, R8125_MSG_DEFAULT); + tp->msg_enable = netif_msg_init(debug.msg_enable, R8126_MSG_DEFAULT); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) if (!aspm) @@ -16489,7 +13065,7 @@ rtl8125_init_board(struct pci_dev *pdev, goto err_out_mwi; } /* check for weird/broken PCI region reporting */ - if (pci_resource_len(pdev, 2) < R8125_REGS_SIZE) { + if (pci_resource_len(pdev, 2) < R8126_REGS_SIZE) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) if (netif_msg_probe(tp)) dev_err(&pdev->dev, "Invalid PCI region size(s), aborting\n"); @@ -16537,9 +13113,9 @@ rtl8125_init_board(struct pci_dev *pdev, tp->mmio_addr = ioaddr; /* Identify chip attached to board */ - rtl8125_get_mac_version(tp); + rtl8126_get_mac_version(tp); - rtl8125_print_mac_version(tp); + rtl8126_print_mac_version(tp); for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { if (tp->mcfg == rtl_chip_info[i].mcfg) @@ -16578,7 +13154,7 @@ err_out: } static void -rtl8125_esd_checker(struct rtl8125_private *tp) +rtl8126_esd_checker(struct rtl8126_private *tp) { struct net_device *dev = tp->dev; struct pci_dev *pdev = tp->pci_dev; @@ -16701,17 +13277,17 @@ rtl8125_esd_checker(struct rtl8125_private *tp) } if (tp->HwPcieSNOffset > 0) { - pci_sn_l = rtl8125_csi_read(tp, tp->HwPcieSNOffset); + pci_sn_l = rtl8126_csi_read(tp, tp->HwPcieSNOffset); if (pci_sn_l != tp->pci_cfg_space.pci_sn_l) { printk(KERN_ERR "%s: pci_sn_l = 0x%08x, should be 0x%08x \n.", dev->name, pci_sn_l, tp->pci_cfg_space.pci_sn_l); - rtl8125_csi_write(tp, tp->HwPcieSNOffset, tp->pci_cfg_space.pci_sn_l); + rtl8126_csi_write(tp, tp->HwPcieSNOffset, tp->pci_cfg_space.pci_sn_l); tp->esd_flag |= BIT_13; } - pci_sn_h = rtl8125_csi_read(tp, tp->HwPcieSNOffset + 4); + pci_sn_h = rtl8126_csi_read(tp, tp->HwPcieSNOffset + 4); if (pci_sn_h != tp->pci_cfg_space.pci_sn_h) { printk(KERN_ERR "%s: pci_sn_h = 0x%08x, should be 0x%08x \n.", dev->name, pci_sn_h, tp->pci_cfg_space.pci_sn_h); - rtl8125_csi_write(tp, tp->HwPcieSNOffset + 4, tp->pci_cfg_space.pci_sn_h); + rtl8126_csi_write(tp, tp->HwPcieSNOffset + 4, tp->pci_cfg_space.pci_sn_h); tp->esd_flag |= BIT_14; } } @@ -16720,13 +13296,13 @@ rtl8125_esd_checker(struct rtl8125_private *tp) printk(KERN_ERR "%s: esd_flag = 0x%04x\n.\n", dev->name, tp->esd_flag); netif_carrier_off(dev); netif_tx_disable(dev); - rtl8125_hw_reset(dev); - rtl8125_tx_clear(tp); - rtl8125_rx_clear(tp); - rtl8125_init_ring(dev); - rtl8125_up(dev); - rtl8125_enable_hw_linkchg_interrupt(tp); - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + rtl8126_hw_reset(dev); + rtl8126_tx_clear(tp); + rtl8126_rx_clear(tp); + rtl8126_init_ring(dev); + rtl8126_up(dev); + rtl8126_enable_hw_linkchg_interrupt(tp); + rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); tp->esd_flag = 0; } exit: @@ -16735,21 +13311,21 @@ exit: /* static void #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -rtl8125_esd_timer(unsigned long __opaque) +rtl8126_esd_timer(unsigned long __opaque) #else -rtl8125_esd_timer(struct timer_list *t) +rtl8126_esd_timer(struct timer_list *t) #endif { #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) struct net_device *dev = (struct net_device *)__opaque; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct timer_list *timer = &tp->esd_timer; #else - struct rtl8125_private *tp = from_timer(tp, t, esd_timer); + struct rtl8126_private *tp = from_timer(tp, t, esd_timer); //struct net_device *dev = tp->dev; struct timer_list *timer = t; #endif - rtl8125_esd_checker(tp); + rtl8126_esd_checker(tp); mod_timer(timer, jiffies + timeout); } @@ -16758,35 +13334,35 @@ rtl8125_esd_timer(struct timer_list *t) /* static void #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) -rtl8125_link_timer(unsigned long __opaque) +rtl8126_link_timer(unsigned long __opaque) #else -rtl8125_link_timer(struct timer_list *t) +rtl8126_link_timer(struct timer_list *t) #endif { #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) struct net_device *dev = (struct net_device *)__opaque; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct timer_list *timer = &tp->link_timer; #else - struct rtl8125_private *tp = from_timer(tp, t, link_timer); + struct rtl8126_private *tp = from_timer(tp, t, link_timer); struct net_device *dev = tp->dev; struct timer_list *timer = t; #endif - rtl8125_check_link_status(dev); + rtl8126_check_link_status(dev); - mod_timer(timer, jiffies + RTL8125_LINK_TIMEOUT); + mod_timer(timer, jiffies + RTL8126_LINK_TIMEOUT); } */ int -rtl8125_enable_msix(struct rtl8125_private *tp) +rtl8126_enable_msix(struct rtl8126_private *tp) { int i, nvecs = 0; - struct msix_entry msix_ent[R8125_MAX_MSIX_VEC]; + struct msix_entry msix_ent[R8126_MAX_MSIX_VEC]; //struct net_device *dev = tp->dev; //const int len = sizeof(tp->irq_tbl[0].name); - for (i = 0; i < R8125_MAX_MSIX_VEC; i++) { + for (i = 0; i < R8126_MAX_MSIX_VEC; i++) { msix_ent[i].entry = i; msix_ent[i].vector = 0; } @@ -16797,38 +13373,18 @@ rtl8125_enable_msix(struct rtl8125_private *tp) goto out; for (i = 0; i < nvecs; i++) { - struct r8125_irq *irq = &tp->irq_tbl[i]; + struct r8126_irq *irq = &tp->irq_tbl[i]; irq->vector = msix_ent[i].vector; //snprintf(irq->name, len, "%s-%d", dev->name, i); - //irq->handler = rtl8125_interrupt_msix; + //irq->handler = rtl8126_interrupt_msix; } out: return nvecs; } -void rtl8125_dump_msix_tbl(struct rtl8125_private *tp) -{ - void __iomem *ioaddr; - - /* ioremap MMIO region */ - ioaddr = ioremap(pci_resource_start(tp->pci_dev, 4), pci_resource_len(tp->pci_dev, 4)); - if (ioaddr) { - int i = 0; - for (i=0; iirq_nvecs; i++) { - printk("entry 0x%d %08X %08X %08X %08X \n", - i, - readl(ioaddr + 16 * i), - readl(ioaddr + 16 * i + 4), - readl(ioaddr + 16 * i + 8), - readl(ioaddr + 16 * i + 12)); - } - iounmap(ioaddr); - } -} - /* Cfg9346_Unlock assumed. */ -static int rtl8125_try_msi(struct rtl8125_private *tp) +static int rtl8126_try_msi(struct rtl8126_private *tp) { struct pci_dev *pdev = tp->pci_dev; unsigned int hw_supp_irq_nvecs; @@ -16836,32 +13392,25 @@ static int rtl8125_try_msi(struct rtl8125_private *tp) 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_10: - hw_supp_irq_nvecs = R8125_MAX_MSIX_VEC_8125B; + case CFG_METHOD_1 ... CFG_METHOD_3: + hw_supp_irq_nvecs = R8126_MAX_MSIX_VEC_8125B; break; default: hw_supp_irq_nvecs = 1; break; } tp->hw_supp_irq_nvecs = clamp_val(hw_supp_irq_nvecs, 1, - R8125_MAX_MSIX_VEC); + R8126_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: - case CFG_METHOD_8: - case CFG_METHOD_9: - case CFG_METHOD_10: + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: tp->max_irq_nvecs = tp->hw_supp_irq_nvecs; - tp->min_irq_nvecs = R8125_MIN_MSIX_VEC_8125B; + tp->min_irq_nvecs = R8126_MIN_MSIX_VEC_8125B; break; } #endif @@ -16873,7 +13422,7 @@ static int rtl8125_try_msi(struct rtl8125_private *tp) pci_dev_msi_enabled(pdev)) msi |= RTL_FEATURE_MSI; #elif LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) - if ((nvecs = rtl8125_enable_msix(tp)) > 0) + if ((nvecs = rtl8126_enable_msix(tp)) > 0) msi |= RTL_FEATURE_MSIX; else if (!pci_enable_msi(pdev)) msi |= RTL_FEATURE_MSI; @@ -16891,7 +13440,7 @@ static int rtl8125_try_msi(struct rtl8125_private *tp) return nvecs; } -static void rtl8125_disable_msi(struct pci_dev *pdev, struct rtl8125_private *tp) +static void rtl8126_disable_msi(struct pci_dev *pdev, struct rtl8126_private *tp) { #if defined(RTL_USE_NEW_INTR_API) if (tp->features & (RTL_FEATURE_MSI | RTL_FEATURE_MSIX)) @@ -16905,7 +13454,7 @@ static void rtl8125_disable_msi(struct pci_dev *pdev, struct rtl8125_private *tp tp->features &= ~(RTL_FEATURE_MSI | RTL_FEATURE_MSIX); } -static int rtl8125_get_irq(struct pci_dev *pdev) +static int rtl8126_get_irq(struct pci_dev *pdev) { #if defined(RTL_USE_NEW_INTR_API) return pci_irq_vector(pdev, 0); @@ -16916,10 +13465,10 @@ static int rtl8125_get_irq(struct pci_dev *pdev) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) static void -rtl8125_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +rtl8126_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; + struct rtl8126_private *tp = netdev_priv(dev); + struct rtl8126_counters *counters = tp->tally_vaddr; dma_addr_t paddr = tp->tally_paddr; if (!counters) @@ -16932,7 +13481,7 @@ rtl8125_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) * Fetch additional counter values missing in stats collected by driver * from tally counters. */ - rtl8125_dump_tally_counter(tp, paddr); + rtl8126_dump_tally_counter(tp, paddr); stats->tx_errors = le64_to_cpu(counters->tx_errors); stats->collisions = le32_to_cpu(counters->tx_multi_collision); @@ -16941,76 +13490,76 @@ rtl8125_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) } #else /** - * rtl8125_get_stats - Get rtl8125 read/write statistics + * rtl8126_get_stats - Get rtl8126 read/write statistics * @dev: The Ethernet Device to get statistics for * - * Get TX/RX statistics for rtl8125 + * Get TX/RX statistics for rtl8126 */ static struct -net_device_stats *rtl8125_get_stats(struct net_device *dev) +net_device_stats *rtl8126_get_stats(struct net_device *dev) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_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, +static const struct net_device_ops rtl8126_netdev_ops = { + .ndo_open = rtl8126_open, + .ndo_stop = rtl8126_close, #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) - .ndo_get_stats64 = rtl8125_get_stats64, + .ndo_get_stats64 = rtl8126_get_stats64, #else - .ndo_get_stats = rtl8125_get_stats, + .ndo_get_stats = rtl8126_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, - .ndo_set_mac_address = rtl8125_set_mac_address, + .ndo_start_xmit = rtl8126_start_xmit, + .ndo_tx_timeout = rtl8126_tx_timeout, + .ndo_change_mtu = rtl8126_change_mtu, + .ndo_set_mac_address = rtl8126_set_mac_address, #if LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) - .ndo_do_ioctl = rtl8125_do_ioctl, + .ndo_do_ioctl = rtl8126_do_ioctl, #else - .ndo_siocdevprivate = rtl8125_siocdevprivate, - .ndo_eth_ioctl = rtl8125_do_ioctl, + .ndo_siocdevprivate = rtl8126_siocdevprivate, + .ndo_eth_ioctl = rtl8126_do_ioctl, #endif //LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) - .ndo_set_multicast_list = rtl8125_set_rx_mode, + .ndo_set_multicast_list = rtl8126_set_rx_mode, #else - .ndo_set_rx_mode = rtl8125_set_rx_mode, + .ndo_set_rx_mode = rtl8126_set_rx_mode, #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) -#ifdef CONFIG_R8125_VLAN - .ndo_vlan_rx_register = rtl8125_vlan_rx_register, +#ifdef CONFIG_R8126_VLAN + .ndo_vlan_rx_register = rtl8126_vlan_rx_register, #endif #else - .ndo_fix_features = rtl8125_fix_features, - .ndo_set_features = rtl8125_set_features, + .ndo_fix_features = rtl8126_fix_features, + .ndo_set_features = rtl8126_set_features, #endif #ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = rtl8125_netpoll, + .ndo_poll_controller = rtl8126_netpoll, #endif }; #endif -#ifdef CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI -static int rtl8125_poll(napi_ptr napi, napi_budget budget) +static int rtl8126_poll(napi_ptr napi, napi_budget budget) { - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = RTL_GET_PRIV(napi, struct r8126_napi); + struct rtl8126_private *tp = r8126napi->priv; RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; int i; for (i = 0; i < tp->num_tx_rings; i++) - rtl8125_tx_interrupt(&tp->tx_ring[i], budget); + rtl8126_tx_interrupt(&tp->tx_ring[i], budget); for (i = 0; i < tp->num_rx_rings; i++) - work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); + work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); @@ -17021,7 +13570,8 @@ 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 @@ -17033,24 +13583,24 @@ static int rtl8125_poll(napi_ptr napi, napi_budget budget) */ smp_wmb(); - rtl8125_switch_to_timer_interrupt(tp); + rtl8126_switch_to_timer_interrupt(tp); } return RTL_NAPI_RETURN_VALUE; } -static int rtl8125_poll_msix_ring(napi_ptr napi, napi_budget budget) +static int rtl8126_poll_msix_ring(napi_ptr napi, napi_budget budget) { - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = RTL_GET_PRIV(napi, struct r8126_napi); + struct rtl8126_private *tp = r8126napi->priv; RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; - const int message_id = r8125napi->index; + const int message_id = r8126napi->index; - rtl8125_tx_interrupt_with_vector(tp, message_id, budget); + rtl8126_tx_interrupt_with_vector(tp, message_id, budget); - work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); + work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); @@ -17061,7 +13611,8 @@ 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 @@ -17073,31 +13624,32 @@ static int rtl8125_poll_msix_ring(napi_ptr napi, napi_budget budget) */ smp_wmb(); - rtl8125_enable_hw_interrupt_v2(tp, message_id); + rtl8126_enable_hw_interrupt_v2(tp, message_id); } return RTL_NAPI_RETURN_VALUE; } -static int rtl8125_poll_msix_tx(napi_ptr napi, napi_budget budget) +static int rtl8126_poll_msix_tx(napi_ptr napi, napi_budget budget) { - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = RTL_GET_PRIV(napi, struct r8126_napi); + struct rtl8126_private *tp = r8126napi->priv; RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; - const int message_id = r8125napi->index; + const int message_id = r8126napi->index; //suppress unused variable (void)(dev); - rtl8125_tx_interrupt_with_vector(tp, message_id, budget); + rtl8126_tx_interrupt_with_vector(tp, message_id, budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); if (work_done < work_to_do) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; + 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 @@ -17109,19 +13661,19 @@ static int rtl8125_poll_msix_tx(napi_ptr napi, napi_budget budget) */ smp_wmb(); - rtl8125_enable_hw_interrupt_v2(tp, message_id); + rtl8126_enable_hw_interrupt_v2(tp, message_id); } return RTL_NAPI_RETURN_VALUE; } -static int rtl8125_poll_msix_other(napi_ptr napi, napi_budget budget) +static int rtl8126_poll_msix_other(napi_ptr napi, napi_budget budget) { - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = RTL_GET_PRIV(napi, struct r8126_napi); + struct rtl8126_private *tp = r8126napi->priv; RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); - const int message_id = r8125napi->index; + const int message_id = r8126napi->index; //suppress unused variable (void)(dev); @@ -17132,27 +13684,28 @@ static int rtl8125_poll_msix_other(napi_ptr napi, napi_budget budget) RTL_NETIF_RX_COMPLETE(dev, napi, work_to_do); #endif - rtl8125_enable_hw_interrupt_v2(tp, message_id); + rtl8126_enable_hw_interrupt_v2(tp, message_id); return 1; } -static int rtl8125_poll_msix_rx(napi_ptr napi, napi_budget budget) +static int rtl8126_poll_msix_rx(napi_ptr napi, napi_budget budget) { - struct r8125_napi *r8125napi = RTL_GET_PRIV(napi, struct r8125_napi); - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = RTL_GET_PRIV(napi, struct r8126_napi); + struct rtl8126_private *tp = r8126napi->priv; RTL_GET_NETDEV(tp) unsigned int work_to_do = RTL_NAPI_QUOTA(budget, dev); unsigned int work_done = 0; - const int message_id = r8125napi->index; + const int message_id = r8126napi->index; - work_done += rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); + work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); if (work_done < work_to_do) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) - if (RTL_NETIF_RX_COMPLETE(dev, napi, work_done) == FALSE) return RTL_NAPI_RETURN_VALUE; + 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 @@ -17164,79 +13717,91 @@ static int rtl8125_poll_msix_rx(napi_ptr napi, napi_budget budget) */ smp_wmb(); - rtl8125_enable_hw_interrupt_v2(tp, message_id); + rtl8126_enable_hw_interrupt_v2(tp, message_id); } return RTL_NAPI_RETURN_VALUE; } -void rtl8125_enable_napi(struct rtl8125_private *tp) +void rtl8126_enable_napi(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) int i; for (i = 0; i < tp->irq_nvecs; i++) - RTL_NAPI_ENABLE(tp->dev, &tp->r8125napi[i].napi); + RTL_NAPI_ENABLE(tp->dev, &tp->r8126napi[i].napi); #endif } -static void rtl8125_disable_napi(struct rtl8125_private *tp) +static void rtl8126_disable_napi(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) int i; for (i = 0; i < tp->irq_nvecs; i++) - RTL_NAPI_DISABLE(tp->dev, &tp->r8125napi[i].napi); + RTL_NAPI_DISABLE(tp->dev, &tp->r8126napi[i].napi); #endif } -static void rtl8125_del_napi(struct rtl8125_private *tp) +static void rtl8126_del_napi(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) int i; for (i = 0; i < tp->irq_nvecs; i++) - RTL_NAPI_DEL((&tp->r8125napi[i])); + RTL_NAPI_DEL((&tp->r8126napi[i])); #endif } -#endif //CONFIG_R8125_NAPI +#endif //CONFIG_R8126_NAPI -static void rtl8125_init_napi(struct rtl8125_private *tp) +static void rtl8126_init_napi(struct rtl8126_private *tp) { int i; for (i=0; iirq_nvecs; i++) { - struct r8125_napi *r8125napi = &tp->r8125napi[i]; -#ifdef CONFIG_R8125_NAPI + struct r8126_napi *r8126napi = &tp->r8126napi[i]; +#ifdef CONFIG_R8126_NAPI int (*poll)(struct napi_struct *, int); - poll = rtl8125_poll; + poll = rtl8126_poll; if (tp->features & RTL_FEATURE_MSIX) { - if (tp->HwCurrIsrVer == 2) { - if (i < R8125_MAX_RX_QUEUES_VEC_V3) - poll = rtl8125_poll_msix_rx; + switch (tp->HwCurrIsrVer) { + case 5: + if (i < R8126_MAX_RX_QUEUES_VEC_V3) + poll = rtl8126_poll_msix_rx; + else if (i == 16 || i == 17) + poll = rtl8126_poll_msix_tx; + else + poll = rtl8126_poll_msix_other; + break; + case 2: + if (i < R8126_MAX_RX_QUEUES_VEC_V3) + poll = rtl8126_poll_msix_rx; else if (i == 16 || i == 18) - poll = rtl8125_poll_msix_tx; + poll = rtl8126_poll_msix_tx; else - poll = rtl8125_poll_msix_other; - } else if (tp->HwCurrIsrVer == 3) { - if (i < R8125_MAX_RX_QUEUES_VEC_V3) - poll = rtl8125_poll_msix_ring; + poll = rtl8126_poll_msix_other; + break; + case 3: + case 4: + if (i < R8126_MAX_RX_QUEUES_VEC_V3) + poll = rtl8126_poll_msix_ring; else - poll = rtl8125_poll_msix_other; + poll = rtl8126_poll_msix_other; + break; } } - RTL_NAPI_CONFIG(tp->dev, r8125napi, poll, R8125_NAPI_WEIGHT); + RTL_NAPI_CONFIG(tp->dev, r8126napi, poll, R8126_NAPI_WEIGHT); #endif - r8125napi->priv = tp; - r8125napi->index = i; + r8126napi->priv = tp; + r8126napi->index = i; } } static int -rtl8125_set_real_num_queue(struct rtl8125_private *tp) +rtl8126_set_real_num_queue(struct rtl8126_private *tp) { int retval = 0; @@ -17265,11 +13830,11 @@ void netdev_sw_irq_coalesce_default_on(struct net_device *dev) #endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) static int __devinit -rtl8125_init_one(struct pci_dev *pdev, +rtl8126_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { struct net_device *dev = NULL; - struct rtl8125_private *tp; + struct rtl8126_private *tp; void __iomem *ioaddr = NULL; static int board_idx = -1; @@ -17282,20 +13847,20 @@ rtl8125_init_one(struct pci_dev *pdev, if (netif_msg_drv(&debug)) printk(KERN_INFO "%s Ethernet controller driver %s loaded\n", - MODULENAME, RTL8125_VERSION); + MODULENAME, RTL8126_VERSION); - rc = rtl8125_init_board(pdev, &dev, &ioaddr); + rc = rtl8126_init_board(pdev, &dev, &ioaddr); if (rc) goto out; tp = netdev_priv(dev); assert(ioaddr != NULL); - tp->set_speed = rtl8125_set_speed_xmii; - tp->get_settings = rtl8125_gset_xmii; - tp->phy_reset_enable = rtl8125_xmii_reset_enable; - tp->phy_reset_pending = rtl8125_xmii_reset_pending; - tp->link_ok = rtl8125_xmii_link_ok; + tp->set_speed = rtl8126_set_speed_xmii; + tp->get_settings = rtl8126_gset_xmii; + tp->phy_reset_enable = rtl8126_xmii_reset_enable; + tp->phy_reset_pending = rtl8126_xmii_reset_pending; + tp->link_ok = rtl8126_xmii_link_ok; #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) dev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev, @@ -17304,31 +13869,31 @@ rtl8125_init_one(struct pci_dev *pdev, goto err_out_1; #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) - rc = rtl8125_try_msi(tp); + rc = rtl8126_try_msi(tp); if (rc < 0) { dev_err(&pdev->dev, "Can't allocate interrupt\n"); goto err_out_1; } - rtl8125_init_software_variable(dev); + rtl8126_init_software_variable(dev); - RTL_NET_DEVICE_OPS(rtl8125_netdev_ops); + RTL_NET_DEVICE_OPS(rtl8126_netdev_ops); #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) - SET_ETHTOOL_OPS(dev, &rtl8125_ethtool_ops); + SET_ETHTOOL_OPS(dev, &rtl8126_ethtool_ops); #endif - dev->watchdog_timeo = RTL8125_TX_TIMEOUT; - dev->irq = rtl8125_get_irq(pdev); + dev->watchdog_timeo = RTL8126_TX_TIMEOUT; + dev->irq = rtl8126_get_irq(pdev); dev->base_addr = (unsigned long) ioaddr; - rtl8125_init_napi(tp); + rtl8126_init_napi(tp); -#ifdef CONFIG_R8125_VLAN +#ifdef CONFIG_R8126_VLAN if (tp->mcfg != CFG_METHOD_DEFAULT) { dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) - dev->vlan_rx_kill_vid = rtl8125_vlan_rx_kill_vid; + dev->vlan_rx_kill_vid = rtl8126_vlan_rx_kill_vid; #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) } #endif @@ -17346,11 +13911,6 @@ rtl8125_init_one(struct pci_dev *pdev, #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; @@ -17368,11 +13928,6 @@ rtl8125_init_one(struct pci_dev *pdev, 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; @@ -17411,27 +13966,27 @@ rtl8125_init_one(struct pci_dev *pdev, #ifdef ENABLE_LIB_SUPPORT BLOCKING_INIT_NOTIFIER_HEAD(&tp->lib_nh); #endif - rtl8125_init_all_schedule_work(tp); + rtl8126_init_all_schedule_work(tp); - rc = rtl8125_set_real_num_queue(tp); + rc = rtl8126_set_real_num_queue(tp); if (rc < 0) goto err_out; - rtl8125_exit_oob(dev); + rtl8126_exit_oob(dev); - rtl8125_powerup_pll(dev); + rtl8126_powerup_pll(dev); - rtl8125_hw_init(dev); + rtl8126_hw_init(dev); - rtl8125_hw_reset(dev); + rtl8126_hw_reset(dev); /* Get production from EEPROM */ - rtl8125_eeprom_type(tp); + rtl8126_eeprom_type(tp); if (tp->eeprom_type == EEPROM_TYPE_93C46 || tp->eeprom_type == EEPROM_TYPE_93C56) - rtl8125_set_eeprom_sel_low(tp); + rtl8126_set_eeprom_sel_low(tp); - rtl8125_get_mac_address(dev); + rtl8126_get_mac_address(dev); tp->fw_name = rtl_chip_fw_infos[tp->mcfg].fw_name; @@ -17442,7 +13997,7 @@ rtl8125_init_one(struct pci_dev *pdev, goto err_out; } - rtl8125_tally_counter_clear(tp); + rtl8126_tally_counter_clear(tp); pci_set_drvdata(pdev, dev); @@ -17452,13 +14007,13 @@ rtl8125_init_one(struct pci_dev *pdev, printk(KERN_INFO "%s: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.\n", MODULENAME); - rtl8125_disable_rxdvgate(dev); + rtl8126_disable_rxdvgate(dev); device_set_wakeup_enable(&pdev->dev, tp->wol_enabled); netif_carrier_off(dev); - rtl8125_sysfs_init(dev); + rtl8126_sysfs_init(dev); printk("%s", GPL_CLAIM); @@ -17472,71 +14027,71 @@ err_out: tp->tally_vaddr = NULL; } -#ifdef CONFIG_R8125_NAPI - rtl8125_del_napi(tp); +#ifdef CONFIG_R8126_NAPI + rtl8126_del_napi(tp); #endif - rtl8125_disable_msi(pdev, tp); + rtl8126_disable_msi(pdev, tp); err_out_1: - rtl8125_release_board(pdev, dev); + rtl8126_release_board(pdev, dev); goto out; } static void __devexit -rtl8125_remove_one(struct pci_dev *pdev) +rtl8126_remove_one(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); assert(dev != NULL); assert(tp != NULL); - set_bit(R8125_FLAG_DOWN, tp->task_flags); + set_bit(R8126_FLAG_DOWN, tp->task_flags); - rtl8125_cancel_all_schedule_work(tp); + rtl8126_cancel_all_schedule_work(tp); -#ifdef CONFIG_R8125_NAPI - rtl8125_del_napi(tp); +#ifdef CONFIG_R8126_NAPI + rtl8126_del_napi(tp); #endif if (HW_DASH_SUPPORT_DASH(tp)) - rtl8125_driver_stop(tp); + rtl8126_driver_stop(tp); -#ifdef ENABLE_R8125_SYSFS - rtl8125_sysfs_remove(dev); -#endif //ENABLE_R8125_SYSFS +#ifdef ENABLE_R8126_SYSFS + rtl8126_sysfs_remove(dev); +#endif //ENABLE_R8126_SYSFS unregister_netdev(dev); - rtl8125_disable_msi(pdev, tp); -#ifdef ENABLE_R8125_PROCFS - rtl8125_proc_remove(dev); + rtl8126_disable_msi(pdev, tp); +#ifdef ENABLE_R8126_PROCFS + rtl8126_proc_remove(dev); #endif if (tp->tally_vaddr != NULL) { dma_free_coherent(&pdev->dev, sizeof(*tp->tally_vaddr), tp->tally_vaddr, tp->tally_paddr); tp->tally_vaddr = NULL; } - rtl8125_release_board(pdev, dev); + rtl8126_release_board(pdev, dev); #ifdef ENABLE_USE_FIRMWARE_FILE - rtl8125_release_firmware(tp); + rtl8126_release_firmware(tp); #endif pci_set_drvdata(pdev, NULL); } #ifdef ENABLE_PAGE_REUSE -static inline unsigned int rtl8125_rx_page_order(unsigned rx_buf_sz, unsigned page_size) +static inline unsigned int rtl8126_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); + SKB_DATA_ALIGN(rx_buf_sz + R8126_RX_ALIGN); return get_order(truesize * 2); } #endif //ENABLE_PAGE_REUSE static void -rtl8125_set_rxbufsize(struct rtl8125_private *tp, +rtl8126_set_rxbufsize(struct rtl8126_private *tp, struct net_device *dev) { unsigned int mtu = dev->mtu; @@ -17549,36 +14104,36 @@ rtl8125_set_rxbufsize(struct rtl8125_private *tp, 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); + tp->rx_buf_page_order = rtl8126_rx_page_order(tp->rx_buf_sz, PAGE_SIZE); + tp->rx_buf_page_size = rtl8126_rx_page_size(tp->rx_buf_page_order); #endif //ENABLE_PAGE_REUSE } -static void rtl8125_free_irq(struct rtl8125_private *tp) +static void rtl8126_free_irq(struct rtl8126_private *tp) { int i; for (i=0; iirq_nvecs; i++) { - struct r8125_irq *irq = &tp->irq_tbl[i]; - struct r8125_napi *r8125napi = &tp->r8125napi[i]; + struct r8126_irq *irq = &tp->irq_tbl[i]; + struct r8126_napi *r8126napi = &tp->r8126napi[i]; if (irq->requested) { irq->requested = 0; #if defined(RTL_USE_NEW_INTR_API) - pci_free_irq(tp->pci_dev, i, r8125napi); + pci_free_irq(tp->pci_dev, i, r8126napi); #else - free_irq(irq->vector, r8125napi); + free_irq(irq->vector, r8126napi); #endif } } } -static int rtl8125_alloc_irq(struct rtl8125_private *tp) +static int rtl8126_alloc_irq(struct rtl8126_private *tp) { struct net_device *dev = tp->dev; int rc = 0; - struct r8125_irq *irq; - struct r8125_napi *r8125napi; + struct r8126_irq *irq; + struct r8126_napi *r8126napi; int i = 0; const int len = sizeof(tp->irq_tbl[0].name); @@ -17587,13 +14142,13 @@ static int rtl8125_alloc_irq(struct rtl8125_private *tp) irq = &tp->irq_tbl[i]; if (tp->features & RTL_FEATURE_MSIX && tp->HwCurrIsrVer > 1) - irq->handler = rtl8125_interrupt_msix; + irq->handler = rtl8126_interrupt_msix; else - irq->handler = rtl8125_interrupt; + irq->handler = rtl8126_interrupt; - r8125napi = &tp->r8125napi[i]; + r8126napi = &tp->r8126napi[i]; snprintf(irq->name, len, "%s-%d", dev->name, i); - rc = pci_request_irq(tp->pci_dev, i, irq->handler, NULL, r8125napi, + rc = pci_request_irq(tp->pci_dev, i, irq->handler, NULL, r8126napi, irq->name); if (rc) break; @@ -17610,10 +14165,10 @@ static int rtl8125_alloc_irq(struct rtl8125_private *tp) tp->HwCurrIsrVer > 1) { for (i=0; iirq_nvecs; i++) { irq = &tp->irq_tbl[i]; - irq->handler = rtl8125_interrupt_msix; - r8125napi = &tp->r8125napi[i]; + irq->handler = rtl8126_interrupt_msix; + r8126napi = &tp->r8126napi[i]; snprintf(irq->name, len, "%s-%d", dev->name, i); - rc = request_irq(irq->vector, irq->handler, irq_flags, irq->name, r8125napi); + rc = request_irq(irq->vector, irq->handler, irq_flags, irq->name, r8126napi); if (rc) break; @@ -17622,27 +14177,27 @@ static int rtl8125_alloc_irq(struct rtl8125_private *tp) } } else { irq = &tp->irq_tbl[0]; - irq->handler = rtl8125_interrupt; - r8125napi = &tp->r8125napi[0]; + irq->handler = rtl8126_interrupt; + r8126napi = &tp->r8126napi[0]; snprintf(irq->name, len, "%s-0", dev->name); if (!(tp->features & RTL_FEATURE_MSIX)) irq->vector = dev->irq; irq_flags |= (tp->features & (RTL_FEATURE_MSI | RTL_FEATURE_MSIX)) ? 0 : SA_SHIRQ; - rc = request_irq(irq->vector, irq->handler, irq_flags, irq->name, r8125napi); + rc = request_irq(irq->vector, irq->handler, irq_flags, irq->name, r8126napi); if (rc == 0) irq->requested = 1; } #endif if (rc) - rtl8125_free_irq(tp); + rtl8126_free_irq(tp); return rc; } -static int rtl8125_alloc_tx_desc(struct rtl8125_private *tp) +static int rtl8126_alloc_tx_desc(struct rtl8126_private *tp) { - struct rtl8125_tx_ring *ring; + struct rtl8126_tx_ring *ring; struct pci_dev *pdev = tp->pci_dev; int i; @@ -17661,9 +14216,9 @@ static int rtl8125_alloc_tx_desc(struct rtl8125_private *tp) return 0; } -static int rtl8125_alloc_rx_desc(struct rtl8125_private *tp) +static int rtl8126_alloc_rx_desc(struct rtl8126_private *tp) { - struct rtl8125_rx_ring *ring; + struct rtl8126_rx_ring *ring; struct pci_dev *pdev = tp->pci_dev; int i; @@ -17682,9 +14237,9 @@ static int rtl8125_alloc_rx_desc(struct rtl8125_private *tp) return 0; } -static void rtl8125_free_tx_desc(struct rtl8125_private *tp) +static void rtl8126_free_tx_desc(struct rtl8126_private *tp) { - struct rtl8125_tx_ring *ring; + struct rtl8126_tx_ring *ring; struct pci_dev *pdev = tp->pci_dev; int i; @@ -17700,9 +14255,9 @@ static void rtl8125_free_tx_desc(struct rtl8125_private *tp) } } -static void rtl8125_free_rx_desc(struct rtl8125_private *tp) +static void rtl8126_free_rx_desc(struct rtl8126_private *tp) { - struct rtl8125_rx_ring *ring; + struct rtl8126_rx_ring *ring; struct pci_dev *pdev = tp->pci_dev; int i; @@ -17718,17 +14273,17 @@ static void rtl8125_free_rx_desc(struct rtl8125_private *tp) } } -static void rtl8125_free_alloc_resources(struct rtl8125_private *tp) +static void rtl8126_free_alloc_resources(struct rtl8126_private *tp) { - rtl8125_free_rx_desc(tp); + rtl8126_free_rx_desc(tp); - rtl8125_free_tx_desc(tp); + rtl8126_free_tx_desc(tp); } #ifdef ENABLE_USE_FIRMWARE_FILE -static void rtl8125_request_firmware(struct rtl8125_private *tp) +static void rtl8126_request_firmware(struct rtl8126_private *tp) { - struct rtl8125_fw *rtl_fw; + struct rtl8126_fw *rtl_fw; /* firmware loaded already or no firmware available */ if (tp->rtl_fw || !tp->fw_name) @@ -17738,43 +14293,43 @@ static void rtl8125_request_firmware(struct rtl8125_private *tp) if (!rtl_fw) return; - rtl_fw->phy_write = rtl8125_mdio_write; - rtl_fw->phy_read = rtl8125_mdio_read; + rtl_fw->phy_write = rtl8126_mdio_write; + rtl_fw->phy_read = rtl8126_mdio_read; rtl_fw->mac_mcu_write = mac_mcu_write; rtl_fw->mac_mcu_read = mac_mcu_read; rtl_fw->fw_name = tp->fw_name; rtl_fw->dev = tp_to_dev(tp); - if (rtl8125_fw_request_firmware(rtl_fw)) + if (rtl8126_fw_request_firmware(rtl_fw)) kfree(rtl_fw); else tp->rtl_fw = rtl_fw; } #endif -int rtl8125_open(struct net_device *dev) +int rtl8126_open(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int retval; retval = -ENOMEM; -#ifdef ENABLE_R8125_PROCFS - rtl8125_proc_init(dev); +#ifdef ENABLE_R8126_PROCFS + rtl8126_proc_init(dev); #endif - rtl8125_set_rxbufsize(tp, dev); + rtl8126_set_rxbufsize(tp, dev); /* * Rx and Tx descriptors needs 256 bytes alignment. * pci_alloc_consistent provides more. */ - if (rtl8125_alloc_tx_desc(tp) < 0 || rtl8125_alloc_rx_desc(tp) < 0) + if (rtl8126_alloc_tx_desc(tp) < 0 || rtl8126_alloc_rx_desc(tp) < 0) goto err_free_all_allocated_mem; - retval = rtl8125_init_ring(dev); + retval = rtl8126_init_ring(dev); if (retval < 0) goto err_free_all_allocated_mem; - retval = rtl8125_alloc_irq(tp); + retval = rtl8126_alloc_irq(tp); if (retval < 0) goto err_free_all_allocated_mem; @@ -17790,51 +14345,51 @@ int rtl8125_open(struct net_device *dev) } #ifdef ENABLE_USE_FIRMWARE_FILE - rtl8125_request_firmware(tp); + rtl8126_request_firmware(tp); #endif pci_set_master(tp->pci_dev); -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); +#ifdef CONFIG_R8126_NAPI + rtl8126_enable_napi(tp); #endif - rtl8125_exit_oob(dev); + rtl8126_exit_oob(dev); - rtl8125_up(dev); + rtl8126_up(dev); #ifdef ENABLE_PTP_SUPPORT if (tp->EnablePtp) - rtl8125_ptp_init(tp); + rtl8126_ptp_init(tp); #endif - clear_bit(R8125_FLAG_DOWN, tp->task_flags); + clear_bit(R8126_FLAG_DOWN, tp->task_flags); if (tp->resume_not_chg_speed) - rtl8125_check_link_status(dev); + rtl8126_check_link_status(dev); else - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); + rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); if (tp->esd_flag == 0) { - //rtl8125_request_esd_timer(dev); + //rtl8126_request_esd_timer(dev); - rtl8125_schedule_esd_work(tp); + rtl8126_schedule_esd_work(tp); } - //rtl8125_request_link_timer(dev); + //rtl8126_request_link_timer(dev); - rtl8125_enable_hw_linkchg_interrupt(tp); + rtl8126_enable_hw_linkchg_interrupt(tp); out: return retval; err_free_all_allocated_mem: - rtl8125_free_alloc_resources(tp); + rtl8126_free_alloc_resources(tp); goto out; } static void -set_offset70F(struct rtl8125_private *tp, u8 setting) +set_offset70F(struct rtl8126_private *tp, u8 setting) { u32 csi_tmp; u32 temp = (u32)setting; @@ -17842,19 +14397,20 @@ set_offset70F(struct rtl8125_private *tp, u8 setting) /*set PCI configuration space offset 0x70F to setting*/ /*When the register offset of PCI configuration space larger than 0xff, use CSI to access it.*/ - csi_tmp = rtl8125_csi_read(tp, 0x70c) & 0x00ffffff; - rtl8125_csi_write(tp, 0x70c, csi_tmp | temp); + csi_tmp = rtl8126_csi_read(tp, 0x70c) & 0x00ffffff; + rtl8126_csi_write(tp, 0x70c, csi_tmp | temp); } static void -set_offset79(struct rtl8125_private *tp, u8 setting) +set_offset79(struct rtl8126_private *tp, u8 setting) { //Set PCI configuration space offset 0x79 to setting struct pci_dev *pdev = tp->pci_dev; u8 device_control; - if (hwoptimize & HW_PATCH_SOC_LAN) return; + if (hwoptimize & HW_PATCH_SOC_LAN) + return; pci_read_config_byte(pdev, 0x79, &device_control); device_control &= ~0x70; @@ -17862,10 +14418,16 @@ set_offset79(struct rtl8125_private *tp, u8 setting) pci_write_config_byte(pdev, 0x79, device_control); } -void -rtl8125_hw_set_rx_packet_filter(struct net_device *dev) +static void +rtl8126_disable_l1_timeout(struct rtl8126_private *tp) { - struct rtl8125_private *tp = netdev_priv(dev); + rtl8126_csi_write(tp, 0x890, rtl8126_csi_read(tp, 0x890) & ~BIT(0)); +} + +void +rtl8126_hw_set_rx_packet_filter(struct net_device *dev) +{ + struct rtl8126_private *tp = netdev_priv(dev); u32 mc_filter[2]; /* Multicast hash filter */ int rx_mode; u32 tmp = 0; @@ -17880,9 +14442,8 @@ rtl8125_hw_set_rx_packet_filter(struct net_device *dev) AcceptBroadcast | AcceptMulticast | AcceptMyPhys | AcceptAllPhys; mc_filter[1] = mc_filter[0] = 0xffffffff; - } else if ((netdev_mc_count(dev) > multicast_filter_limit) - || (dev->flags & IFF_ALLMULTI)) { - /* Too many to filter perfectly -- accept all multicasts. */ + } else if (dev->flags & IFF_ALLMULTI) { + /* accept all multicasts. */ rx_mode = AcceptBroadcast | AcceptMulticast | AcceptMyPhys; mc_filter[1] = mc_filter[0] = 0xffffffff; } else { @@ -17918,7 +14479,7 @@ rtl8125_hw_set_rx_packet_filter(struct net_device *dev) mc_filter[0] = swab32(mc_filter[1]); mc_filter[1] = swab32(tmp); - tmp = tp->rtl8125_rx_config | rx_mode | (RTL_R32(tp, RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); + tmp = tp->rtl8126_rx_config | rx_mode | (RTL_R32(tp, RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); RTL_W32(tp, RxConfig, tmp); RTL_W32(tp, MAR0 + 0, mc_filter[0]); @@ -17926,13 +14487,13 @@ rtl8125_hw_set_rx_packet_filter(struct net_device *dev) } static void -rtl8125_set_rx_mode(struct net_device *dev) +rtl8126_set_rx_mode(struct net_device *dev) { - rtl8125_hw_set_rx_packet_filter(dev); + rtl8126_hw_set_rx_packet_filter(dev); } void -rtl8125_set_rx_q_num(struct rtl8125_private *tp, +rtl8126_set_rx_q_num(struct rtl8126_private *tp, unsigned int num_rx_queues) { u16 q_ctrl; @@ -17948,112 +14509,97 @@ rtl8125_set_rx_q_num(struct rtl8125_private *tp, } void -rtl8125_set_tx_q_num(struct rtl8125_private *tp, +rtl8126_set_tx_q_num(struct rtl8126_private *tp, unsigned int num_tx_queues) { u16 mac_ocp_data; - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE63E); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xE63E); mac_ocp_data &= ~(BIT_11 | BIT_10); mac_ocp_data |= ((ilog2(num_tx_queues) & 0x03) << 10); - rtl8125_mac_ocp_write(tp, 0xE63E, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xE63E, mac_ocp_data); } void -rtl8125_enable_mcu(struct rtl8125_private *tp, bool enable) +rtl8126_enable_mcu(struct rtl8126_private *tp, bool enable) { if (FALSE == HW_SUPPORT_MAC_MCU(tp)) return; - if(enable) - rtl8125_set_mac_ocp_bit(tp, 0xC0B4, BIT_0); + if (enable) + rtl8126_set_mac_ocp_bit(tp, 0xC0B4, BIT_0); else - rtl8125_clear_mac_ocp_bit(tp, 0xC0B4, BIT_0); + rtl8126_clear_mac_ocp_bit(tp, 0xC0B4, BIT_0); } static void -rtl8125_clear_tcam_entries(struct rtl8125_private *tp) +rtl8126_clear_tcam_entries(struct rtl8126_private *tp) { if (FALSE == HW_SUPPORT_TCAM(tp)) return; - rtl8125_set_mac_ocp_bit(tp, 0xEB54, BIT_0); + rtl8126_set_mac_ocp_bit(tp, 0xEB54, BIT_0); udelay(1); - rtl8125_clear_mac_ocp_bit(tp, 0xEB54, BIT_0); + rtl8126_clear_mac_ocp_bit(tp, 0xEB54, BIT_0); } -static void -rtl8125_enable_tcam(struct rtl8125_private *tp) +static u8 +rtl8126_get_l1off_cap_bits(struct rtl8126_private *tp) { - if (tp->HwSuppTcamVer != 1) - return; + u8 l1offCapBits = 0; - RTL_W16(tp, 0x382, 0x221B); + l1offCapBits = (BIT_0 | BIT_1); + switch (tp->mcfg) { + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + l1offCapBits |= (BIT_2 | BIT_3); + default: + break; + } + + return l1offCapBits; } void -rtl8125_hw_config(struct net_device *dev) +rtl8126_hw_config(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); struct pci_dev *pdev = tp->pci_dev; u16 mac_ocp_data; - RTL_W32(tp, RxConfig, (RX_DMA_BURST_unlimited << RxCfgDMAShift)); + rtl8126_disable_rx_packet_filter(tp); - rtl8125_hw_reset(dev); + rtl8126_hw_reset(dev); - rtl8125_enable_cfg9346_write(tp); + rtl8126_enable_cfg9346_write(tp); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_enable_force_clkreq(tp, 0); - rtl8125_enable_aspm_clkreq_lock(tp, 0); + rtl8126_enable_force_clkreq(tp, 0); + rtl8126_enable_aspm_clkreq_lock(tp, 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; - } + rtl8126_set_eee_lpi_timer(tp); //keep magic packet only switch (tp->mcfg) { + case CFG_METHOD_1: 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: - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xC0B6); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xC0B6); mac_ocp_data &= BIT_0; - rtl8125_mac_ocp_write(tp, 0xC0B6, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xC0B6, mac_ocp_data); break; } - rtl8125_tally_counter_addr_fill(tp); + rtl8126_tally_counter_addr_fill(tp); - rtl8125_enable_extend_tally_couter(tp); + rtl8126_enable_extend_tally_couter(tp); - rtl8125_desc_addr_fill(tp); + rtl8126_desc_addr_fill(tp); /* Set DMA burst size and Interframe Gap Time */ RTL_W32(tp, TxConfig, (TX_DMA_BURST_unlimited << TxDMAShift) | @@ -18063,132 +14609,116 @@ rtl8125_hw_config(struct net_device *dev) RTL_W32(tp, TxConfig, (RTL_R32(tp, TxConfig) | BIT_6)); if (enable_double_vlan) - rtl8125_enable_double_vlan(tp); + rtl8126_enable_double_vlan(tp); else - rtl8125_disable_double_vlan(tp); + rtl8126_disable_double_vlan(tp); - 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) { + if (tp->mcfg == CFG_METHOD_1 || + tp->mcfg == CFG_METHOD_2 || + tp->mcfg == CFG_METHOD_3) { set_offset70F(tp, 0x27); set_offset79(tp, 0x40); - if (tp->HwSuppTcamVer == 1) - rtl8125_enable_tcam(tp); + rtl8126_disable_l1_timeout(tp); #ifdef ENABLE_RSS_SUPPORT - rtl8125_config_rss(tp); + rtl8126_config_rss(tp); #else RTL_W32(tp, RSS_CTRL_8125, 0x00); #endif - rtl8125_set_rx_q_num(tp, rtl8125_tot_rx_rings(tp)); + rtl8126_set_rx_q_num(tp, rtl8126_tot_rx_rings(tp)); RTL_W8(tp, Config1, RTL_R8(tp, Config1) & ~0x10); - rtl8125_mac_ocp_write(tp, 0xC140, 0xFFFF); - rtl8125_mac_ocp_write(tp, 0xC142, 0xFFFF); + rtl8126_mac_ocp_write(tp, 0xC140, 0xFFFF); + rtl8126_mac_ocp_write(tp, 0xC142, 0xFFFF); //new tx desc format - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEB58); - if (tp->mcfg == CFG_METHOD_9 || tp->mcfg == CFG_METHOD_10) + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xEB58); + if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3) mac_ocp_data &= ~(BIT_0 | BIT_1); mac_ocp_data |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xEB58, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xEB58, mac_ocp_data); - if (tp->mcfg == CFG_METHOD_9 || tp->mcfg == CFG_METHOD_10) + if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3) RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~BIT_1); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE614); - mac_ocp_data &= ~( BIT_10 | BIT_9 | BIT_8); - if (tp->mcfg == CFG_METHOD_4 || tp->mcfg == CFG_METHOD_5 || - tp->mcfg == CFG_METHOD_7) - mac_ocp_data |= ((2 & 0x07) << 8); - else if (tp->mcfg == CFG_METHOD_8 || tp->mcfg == CFG_METHOD_9 || - tp->mcfg == CFG_METHOD_10) + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xE614); + mac_ocp_data &= ~(BIT_10 | BIT_9 | BIT_8); + if (tp->mcfg == CFG_METHOD_1 || tp->mcfg == CFG_METHOD_2 || + tp->mcfg == CFG_METHOD_3) mac_ocp_data |= ((4 & 0x07) << 8); else mac_ocp_data |= ((3 & 0x07) << 8); - rtl8125_mac_ocp_write(tp, 0xE614, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xE614, mac_ocp_data); - rtl8125_set_tx_q_num(tp, rtl8125_tot_tx_rings(tp)); + rtl8126_set_tx_q_num(tp, rtl8126_tot_tx_rings(tp)); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE63E); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xE63E); mac_ocp_data &= ~(BIT_5 | BIT_4); - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6 || tp->mcfg == CFG_METHOD_8 || - tp->mcfg == CFG_METHOD_9 || tp->mcfg == CFG_METHOD_10) + if (tp->mcfg == CFG_METHOD_1 || tp->mcfg == CFG_METHOD_2 || + tp->mcfg == CFG_METHOD_3) mac_ocp_data |= ((0x02 & 0x03) << 4); - rtl8125_mac_ocp_write(tp, 0xE63E, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xE63E, mac_ocp_data); - rtl8125_enable_mcu(tp, 0); - rtl8125_enable_mcu(tp, 1); + rtl8126_enable_mcu(tp, 0); + rtl8126_enable_mcu(tp, 1); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xC0B4); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xC0B4); mac_ocp_data |= (BIT_3 | BIT_2); - rtl8125_mac_ocp_write(tp, 0xC0B4, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xC0B4, mac_ocp_data); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEB6A); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xEB6A); mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); mac_ocp_data |= (BIT_5 | BIT_4 | BIT_1 | BIT_0); - rtl8125_mac_ocp_write(tp, 0xEB6A, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xEB6A, mac_ocp_data); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEB50); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xEB50); mac_ocp_data &= ~(BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5); mac_ocp_data |= (BIT_6); - rtl8125_mac_ocp_write(tp, 0xEB50, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xEB50, mac_ocp_data); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE056); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xE056); mac_ocp_data &= ~(BIT_7 | BIT_6 | BIT_5 | BIT_4); //mac_ocp_data |= (BIT_4 | BIT_5); - rtl8125_mac_ocp_write(tp, 0xE056, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xE056, mac_ocp_data); RTL_W8(tp, TDFNR, 0x10); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xE040); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xE040); mac_ocp_data &= ~(BIT_12); - rtl8125_mac_ocp_write(tp, 0xE040, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xE040, mac_ocp_data); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEA1C); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xEA1C); mac_ocp_data &= ~(BIT_1 | BIT_0); mac_ocp_data |= (BIT_0); - rtl8125_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); - rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4000); + rtl8126_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); + rtl8126_set_mac_ocp_bit(tp, 0xE052, (BIT_6 | BIT_5)); + rtl8126_clear_mac_ocp_bit(tp, 0xE052, BIT_3 | BIT_7); - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xD430); + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xD430); mac_ocp_data &= ~(BIT_11 | BIT_10 | BIT_9 | BIT_8 | BIT_7 | BIT_6 | BIT_5 | BIT_4 | BIT_3 | BIT_2 | BIT_1 | BIT_0); mac_ocp_data |= 0x45F; - rtl8125_mac_ocp_write(tp, 0xD430, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xD430, mac_ocp_data); - //rtl8125_mac_ocp_write(tp, 0xE0C0, 0x4F87); + //rtl8126_mac_ocp_write(tp, 0xE0C0, 0x4F87); if (!tp->DASH) RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) | BIT_6 | BIT_7); else RTL_W8(tp, 0xD0, RTL_R8(tp, 0xD0) & ~(BIT_6 | BIT_7)); - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3 || - tp->mcfg == CFG_METHOD_6) - RTL_W8(tp, MCUCmd_reg, RTL_R8(tp, MCUCmd_reg) | BIT_0); + rtl8126_disable_eee_plus(tp); - rtl8125_disable_eee_plus(tp); - - mac_ocp_data = rtl8125_mac_ocp_read(tp, 0xEA1C); - if (tp->mcfg == CFG_METHOD_9 || tp->mcfg == CFG_METHOD_10) + mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xEA1C); + mac_ocp_data &= ~(BIT_2); + if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3) mac_ocp_data &= ~(BIT_9 | BIT_8); - else - mac_ocp_data &= ~(BIT_2); - rtl8125_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); + rtl8126_mac_ocp_write(tp, 0xEA1C, mac_ocp_data); - rtl8125_clear_tcam_entries(tp); + rtl8126_clear_tcam_entries(tp); RTL_W16(tp, 0x1880, RTL_R16(tp, 0x1880) & ~(BIT_4 | BIT_5)); } @@ -18201,12 +14731,12 @@ rtl8125_hw_config(struct net_device *dev) /* config interrupt type for RTL8125B */ if (tp->HwSuppIsrVer > 1) - rtl8125_hw_set_interrupt_type(tp, tp->HwCurrIsrVer); + rtl8126_hw_set_interrupt_type(tp, tp->HwCurrIsrVer); //other hw parameters - rtl8125_hw_clear_timer_int(dev); + rtl8126_hw_clear_timer_int(dev); - rtl8125_hw_clear_int_miti(dev); + rtl8126_hw_clear_int_miti(dev); if (tp->use_timer_interrupt && (tp->HwCurrIsrVer > 1) && @@ -18214,56 +14744,38 @@ rtl8125_hw_config(struct net_device *dev) (tp->features & RTL_FEATURE_MSIX)) { int i; for (i = 0; i < tp->irq_nvecs; i++) - rtl8125_hw_set_timer_int_8125(tp, i, timer_count_v2); + rtl8126_hw_set_timer_int_8125(tp, i, timer_count_v2); } - rtl8125_enable_exit_l1_mask(tp); + rtl8126_enable_exit_l1_mask(tp); switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_mac_ocp_write(tp, 0xE098, 0xC302); + rtl8126_mac_ocp_write(tp, 0xE098, 0xC302); break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_disable_pci_offset_99(tp); + rtl8126_disable_pci_offset_99(tp); if (aspm) { if (tp->org_pci_offset_99 & (BIT_2 | BIT_5 | BIT_6)) - rtl8125_init_pci_offset_99(tp); + rtl8126_init_pci_offset_99(tp); } break; } switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_disable_pci_offset_180(tp); + rtl8126_disable_pci_offset_180(tp); if (aspm) { - if (tp->org_pci_offset_180 & (BIT_0|BIT_1)) - rtl8125_init_pci_offset_180(tp); + if (tp->org_pci_offset_180 & rtl8126_get_l1off_cap_bits(tp)) + rtl8126_init_pci_offset_180(tp); } break; } @@ -18275,11 +14787,11 @@ rtl8125_hw_config(struct net_device *dev) #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) RTL_W16(tp, CPlusCmd, tp->cp_cmd); #else - rtl8125_hw_set_features(dev, dev->features); + rtl8126_hw_set_features(dev, dev->features); #endif RTL_W16(tp, RxMaxSize, tp->rms); - rtl8125_disable_rxdvgate(dev); + rtl8126_disable_rxdvgate(dev); if (!tp->pci_cfg_is_read) { pci_read_config_byte(pdev, PCI_COMMAND, &tp->pci_cfg_space.cmd); @@ -18297,15 +14809,15 @@ rtl8125_hw_config(struct net_device *dev) pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &tp->pci_cfg_space.resv_0x2c_l); pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID + 2, &tp->pci_cfg_space.resv_0x2c_h); if (tp->HwPcieSNOffset > 0) { - tp->pci_cfg_space.pci_sn_l = rtl8125_csi_read(tp, tp->HwPcieSNOffset); - tp->pci_cfg_space.pci_sn_h = rtl8125_csi_read(tp, tp->HwPcieSNOffset + 4); + tp->pci_cfg_space.pci_sn_l = rtl8126_csi_read(tp, tp->HwPcieSNOffset); + tp->pci_cfg_space.pci_sn_h = rtl8126_csi_read(tp, tp->HwPcieSNOffset + 4); } tp->pci_cfg_is_read = 1; } /* Set Rx packet filter */ - rtl8125_hw_set_rx_packet_filter(dev); + rtl8126_hw_set_rx_packet_filter(dev); #ifdef ENABLE_DASH_SUPPORT if (tp->DASH && !tp->dash_printer_enabled) @@ -18313,45 +14825,39 @@ rtl8125_hw_config(struct net_device *dev) #endif switch (tp->mcfg) { + case CFG_METHOD_1: 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: - rtl8125_enable_aspm_clkreq_lock(tp, aspm ? 1 : 0); + rtl8126_enable_aspm_clkreq_lock(tp, aspm ? 1 : 0); break; } - rtl8125_disable_cfg9346_write(tp); + rtl8126_disable_cfg9346_write(tp); udelay(10); } void -rtl8125_hw_start(struct net_device *dev) +rtl8126_hw_start(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); #ifdef ENABLE_LIB_SUPPORT - rtl8125_init_lib_ring(tp); + rtl8126_init_lib_ring(tp); #endif RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); - rtl8125_enable_hw_interrupt(tp); + rtl8126_enable_hw_interrupt(tp); - rtl8125_lib_reset_complete(tp); + rtl8126_lib_reset_complete(tp); } static int -rtl8125_change_mtu(struct net_device *dev, +rtl8126_change_mtu(struct net_device *dev, int new_mtu) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ret = 0; #if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0) @@ -18368,26 +14874,26 @@ rtl8125_change_mtu(struct net_device *dev, if (!netif_running(dev)) goto out; - rtl8125_down(dev); + rtl8126_down(dev); - rtl8125_set_rxbufsize(tp, dev); + rtl8126_set_rxbufsize(tp, dev); - ret = rtl8125_init_ring(dev); + ret = rtl8126_init_ring(dev); if (ret < 0) goto err_out; -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); -#endif//CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI + rtl8126_enable_napi(tp); +#endif//CONFIG_R8126_NAPI if (tp->link_ok(dev)) - rtl8125_link_on_patch(dev); + rtl8126_link_on_patch(dev); else - rtl8125_link_down_patch(dev); + rtl8126_link_down_patch(dev); - //mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); - //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); + //mod_timer(&tp->esd_timer, jiffies + RTL8126_ESD_TIMEOUT); + //mod_timer(&tp->link_timer, jiffies + RTL8126_LINK_TIMEOUT); out: #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) netdev_update_features(dev); @@ -18398,7 +14904,7 @@ err_out: } static inline void -rtl8125_set_desc_dma_addr(struct rtl8125_private *tp, +rtl8126_set_desc_dma_addr(struct rtl8126_private *tp, struct RxDesc *desc, dma_addr_t mapping) { @@ -18409,7 +14915,7 @@ rtl8125_set_desc_dma_addr(struct rtl8125_private *tp, } static inline void -rtl8125_mark_to_asic_v3(struct RxDescV3 *descv3, +rtl8126_mark_to_asic_v3(struct RxDescV3 *descv3, u32 rx_buf_sz) { u32 eor = le32_to_cpu(descv3->RxDescNormalDDWord4.opts1) & RingEnd; @@ -18418,12 +14924,12 @@ rtl8125_mark_to_asic_v3(struct RxDescV3 *descv3, } void -rtl8125_mark_to_asic(struct rtl8125_private *tp, +rtl8126_mark_to_asic(struct rtl8126_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); + rtl8126_mark_to_asic_v3((struct RxDescV3 *)desc, rx_buf_sz); else { u32 eor = le32_to_cpu(desc->opts1) & RingEnd; @@ -18432,24 +14938,24 @@ rtl8125_mark_to_asic(struct rtl8125_private *tp, } static inline void -rtl8125_map_to_asic(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_map_to_asic(struct rtl8126_private *tp, + struct rtl8126_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); + rtl8126_set_desc_dma_addr(tp, desc, mapping); wmb(); - rtl8125_mark_to_asic(tp, desc, rx_buf_sz); + rtl8126_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) +rtl8126_alloc_rx_page(struct rtl8126_private *tp, struct rtl8126_rx_ring *ring, + struct rtl8126_rx_buffer *rxb) { struct page *page; dma_addr_t dma; @@ -18482,7 +14988,7 @@ rtl8125_alloc_rx_page(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring, } static void -rtl8125_free_rx_page(struct rtl8125_private *tp, struct rtl8125_rx_buffer *rxb) +rtl8126_free_rx_page(struct rtl8126_private *tp, struct rtl8126_rx_buffer *rxb) { if (!rxb->page) return; @@ -18496,10 +15002,10 @@ rtl8125_free_rx_page(struct rtl8125_private *tp, struct rtl8125_rx_buffer *rxb) } static void -_rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) +_rtl8126_rx_clear(struct rtl8126_private *tp, struct rtl8126_rx_ring *ring) { int i; - struct rtl8125_rx_buffer *rxb; + struct rtl8126_rx_buffer *rxb; for (i = 0; i < ring->num_rx_desc; i++) { rxb = &ring->rx_buffer[i]; @@ -18507,20 +15013,20 @@ _rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) dev_kfree_skb(rxb->skb); rxb->skb = NULL; } - rtl8125_free_rx_page(tp, rxb); + rtl8126_free_rx_page(tp, rxb); } } static u32 -rtl8125_rx_fill(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_rx_fill(struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, struct net_device *dev, u32 start, u32 end, u8 in_intr) { u32 cur; - struct rtl8125_rx_buffer *rxb; + struct rtl8126_rx_buffer *rxb; for (cur = start; end - cur > 0; cur++) { int ret, i = cur % ring->num_rx_desc; @@ -18529,7 +15035,7 @@ rtl8125_rx_fill(struct rtl8125_private *tp, if (rxb->page) continue; - ret = rtl8125_alloc_rx_page(tp, ring, rxb); + ret = rtl8126_alloc_rx_page(tp, ring, rxb); if (ret) break; @@ -18539,7 +15045,8 @@ rtl8125_rx_fill(struct rtl8125_private *tp, tp->rx_buf_sz, DMA_FROM_DEVICE); - rtl8125_map_to_asic(tp, ring, ring->RxDescArray + i, + rtl8126_map_to_asic(tp, ring, + rtl8126_get_rxdesc(tp, ring->RxDescArray, i), rxb->dma + rxb->page_offset, tp->rx_buf_sz, i); } @@ -18549,8 +15056,8 @@ rtl8125_rx_fill(struct rtl8125_private *tp, #else //ENABLE_PAGE_REUSE static void -rtl8125_free_rx_skb(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_free_rx_skb(struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, struct sk_buff **sk_buff, struct RxDesc *desc, const u32 cur_rx) @@ -18561,12 +15068,12 @@ rtl8125_free_rx_skb(struct rtl8125_private *tp, DMA_FROM_DEVICE); dev_kfree_skb(*sk_buff); *sk_buff = NULL; - rtl8125_make_unusable_by_asic(tp, desc); + rtl8126_make_unusable_by_asic(tp, desc); } static int -rtl8125_alloc_rx_skb(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_alloc_rx_skb(struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, struct sk_buff **sk_buff, struct RxDesc *desc, int rx_buf_sz, @@ -18578,15 +15085,15 @@ 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->r8126napi[ring->index].napi, rx_buf_sz + R8126_RX_ALIGN); else - skb = dev_alloc_skb(rx_buf_sz + R8125_RX_ALIGN); + skb = dev_alloc_skb(rx_buf_sz + R8126_RX_ALIGN); if (unlikely(!skb)) goto err_out; - if (!in_intr || !R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); + if (!in_intr || !R8126_USE_NAPI_ALLOC_SKB) + skb_reserve(skb, R8126_RX_ALIGN); mapping = dma_map_single(tp_to_dev(tp), skb->data, rx_buf_sz, DMA_FROM_DEVICE); @@ -18597,7 +15104,7 @@ rtl8125_alloc_rx_skb(struct rtl8125_private *tp, } *sk_buff = skb; - rtl8125_map_to_asic(tp, ring, desc, mapping, rx_buf_sz, cur_rx); + rtl8126_map_to_asic(tp, ring, desc, mapping, rx_buf_sz, cur_rx); out: return ret; @@ -18605,21 +15112,21 @@ err_out: if (skb) dev_kfree_skb(skb); ret = -ENOMEM; - rtl8125_make_unusable_by_asic(tp, desc); + rtl8126_make_unusable_by_asic(tp, desc); goto out; } static void -_rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) +_rtl8126_rx_clear(struct rtl8126_private *tp, struct rtl8126_rx_ring *ring) { int i; for (i = 0; i < ring->num_rx_desc; i++) { if (ring->Rx_skbuff[i]) { - rtl8125_free_rx_skb(tp, + rtl8126_free_rx_skb(tp, ring, ring->Rx_skbuff + i, - rtl8125_get_rxdesc(tp, ring->RxDescArray, i), + rtl8126_get_rxdesc(tp, ring->RxDescArray, i), i); ring->Rx_skbuff[i] = NULL; } @@ -18627,8 +15134,8 @@ _rtl8125_rx_clear(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring) } static u32 -rtl8125_rx_fill(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_rx_fill(struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, struct net_device *dev, u32 start, u32 end, @@ -18642,14 +15149,13 @@ rtl8125_rx_fill(struct rtl8125_private *tp, if (ring->Rx_skbuff[i]) continue; - ret = rtl8125_alloc_rx_skb(tp, + ret = rtl8126_alloc_rx_skb(tp, ring, ring->Rx_skbuff + i, - rtl8125_get_rxdesc(tp, ring->RxDescArray, i), + rtl8126_get_rxdesc(tp, ring->RxDescArray, i), tp->rx_buf_sz, i, - in_intr - ); + in_intr); if (ret < 0) break; } @@ -18659,58 +15165,58 @@ rtl8125_rx_fill(struct rtl8125_private *tp, #endif //ENABLE_PAGE_REUSE void -rtl8125_rx_clear(struct rtl8125_private *tp) +rtl8126_rx_clear(struct rtl8126_private *tp) { int i; for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; - _rtl8125_rx_clear(tp, ring); + _rtl8126_rx_clear(tp, ring); } } static inline void -rtl8125_mark_as_last_descriptor_8125(struct RxDescV3 *descv3) +rtl8126_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, +rtl8126_mark_as_last_descriptor(struct rtl8126_private *tp, struct RxDesc *desc) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - rtl8125_mark_as_last_descriptor_8125((struct RxDescV3 *)desc); + rtl8126_mark_as_last_descriptor_8125((struct RxDescV3 *)desc); else desc->opts1 |= cpu_to_le32(RingEnd); } static void -rtl8125_desc_addr_fill(struct rtl8125_private *tp) +rtl8126_desc_addr_fill(struct rtl8126_private *tp) { int i; for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; RTL_W32(tp, ring->tdsar_reg, ((u64)ring->TxPhyAddr & DMA_BIT_MASK(32))); RTL_W32(tp, ring->tdsar_reg + 4, ((u64)ring->TxPhyAddr >> 32)); } for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; RTL_W32(tp, ring->rdsar_reg, ((u64)ring->RxPhyAddr & DMA_BIT_MASK(32))); RTL_W32(tp, ring->rdsar_reg + 4, ((u64)ring->RxPhyAddr >> 32)); } } static void -rtl8125_tx_desc_init(struct rtl8125_private *tp) +rtl8126_tx_desc_init(struct rtl8126_private *tp) { int i = 0; for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; memset(ring->TxDescArray, 0x0, ring->TxDescAllocSize); ring->TxDescArray[ring->num_tx_desc - 1].opts1 = cpu_to_le32(RingEnd); @@ -18718,54 +15224,54 @@ rtl8125_tx_desc_init(struct rtl8125_private *tp) } static void -rtl8125_rx_desc_init(struct rtl8125_private *tp) +rtl8126_rx_desc_init(struct rtl8126_private *tp) { int i; for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; memset(ring->RxDescArray, 0x0, ring->RxDescAllocSize); } } int -rtl8125_init_ring(struct net_device *dev) +rtl8126_init_ring(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; - rtl8125_init_ring_indexes(tp); + rtl8126_init_ring_indexes(tp); - rtl8125_tx_desc_init(tp); - rtl8125_rx_desc_init(tp); + rtl8126_tx_desc_init(tp); + rtl8126_rx_desc_init(tp); for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; memset(ring->tx_skb, 0x0, sizeof(ring->tx_skb)); } for (i = 0; i < tp->num_rx_rings; i++) { - struct rtl8125_rx_ring *ring = &tp->rx_ring[i]; + struct rtl8126_rx_ring *ring = &tp->rx_ring[i]; #ifdef ENABLE_PAGE_REUSE - ring->rx_offset = R8125_RX_ALIGN; + ring->rx_offset = R8126_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) + if (rtl8126_rx_fill(tp, ring, dev, 0, ring->num_rx_desc, 0) != ring->num_rx_desc) goto err_out; - rtl8125_mark_as_last_descriptor(tp, rtl8125_get_rxdesc(tp, ring->RxDescArray, ring->num_rx_desc - 1)); + rtl8126_mark_as_last_descriptor(tp, rtl8126_get_rxdesc(tp, ring->RxDescArray, ring->num_rx_desc - 1)); } return 0; err_out: - rtl8125_rx_clear(tp); + rtl8126_rx_clear(tp); return -ENOMEM; } static void -rtl8125_unmap_tx_skb(struct pci_dev *pdev, +rtl8126_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, struct TxDesc *desc) { @@ -18775,13 +15281,13 @@ rtl8125_unmap_tx_skb(struct pci_dev *pdev, desc->opts1 = cpu_to_le32(RTK_MAGIC_DEBUG_VALUE); desc->opts2 = 0x00; - desc->addr = RTL8125_MAGIC_NUMBER; + desc->addr = RTL8126_MAGIC_NUMBER; tx_skb->len = 0; } static void -rtl8125_tx_clear_range(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring, +rtl8126_tx_clear_range(struct rtl8126_private *tp, + struct rtl8126_tx_ring *ring, u32 start, unsigned int n) { @@ -18798,7 +15304,7 @@ rtl8125_tx_clear_range(struct rtl8125_private *tp, if (len) { struct sk_buff *skb = tx_skb->skb; - rtl8125_unmap_tx_skb(tp->pci_dev, tx_skb, + rtl8126_unmap_tx_skb(tp->pci_dev, tx_skb, ring->TxDescArray + entry); if (skb) { RTLDEV->stats.tx_dropped++; @@ -18810,115 +15316,118 @@ rtl8125_tx_clear_range(struct rtl8125_private *tp, } void -rtl8125_tx_clear(struct rtl8125_private *tp) +rtl8126_tx_clear(struct rtl8126_private *tp) { int i; for (i = 0; i < tp->num_tx_rings; i++) { - struct rtl8125_tx_ring *ring = &tp->tx_ring[i]; - rtl8125_tx_clear_range(tp, ring, ring->dirty_tx, ring->num_tx_desc); + struct rtl8126_tx_ring *ring = &tp->tx_ring[i]; + rtl8126_tx_clear_range(tp, ring, ring->dirty_tx, ring->num_tx_desc); ring->cur_tx = ring->dirty_tx = 0; } } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_schedule_reset_work(struct rtl8125_private *tp) +static void rtl8126_schedule_reset_work(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - set_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags); + set_bit(R8126_FLAG_TASK_RESET_PENDING, tp->task_flags); schedule_delayed_work(&tp->reset_task, 4); #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) } -static void rtl8125_schedule_esd_work(struct rtl8125_private *tp) +static void rtl8126_schedule_esd_work(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - set_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); - schedule_delayed_work(&tp->esd_task, RTL8125_ESD_TIMEOUT); + set_bit(R8126_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); + schedule_delayed_work(&tp->esd_task, RTL8126_ESD_TIMEOUT); #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) } -static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp) +static void rtl8126_schedule_linkchg_work(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - set_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); + set_bit(R8126_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); schedule_delayed_work(&tp->linkchg_task, 4); #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) } -#define rtl8125_cancel_schedule_reset_work(a) -#define rtl8125_cancel_schedule_esd_work(a) -#define rtl8125_cancel_schedule_linkchg_work(a) +#define rtl8126_cancel_schedule_reset_work(a) +#define rtl8126_cancel_schedule_esd_work(a) +#define rtl8126_cancel_schedule_linkchg_work(a) #else -static void rtl8125_schedule_reset_work(struct rtl8125_private *tp) +static void rtl8126_schedule_reset_work(struct rtl8126_private *tp) { - set_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags); + set_bit(R8126_FLAG_TASK_RESET_PENDING, tp->task_flags); schedule_delayed_work(&tp->reset_task, 4); } -static void rtl8125_cancel_schedule_reset_work(struct rtl8125_private *tp) +static void rtl8126_cancel_schedule_reset_work(struct rtl8126_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); } -static void rtl8125_schedule_esd_work(struct rtl8125_private *tp) +static void rtl8126_schedule_esd_work(struct rtl8126_private *tp) { - set_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); - schedule_delayed_work(&tp->esd_task, RTL8125_ESD_TIMEOUT); + set_bit(R8126_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags); + schedule_delayed_work(&tp->esd_task, RTL8126_ESD_TIMEOUT); } -static void rtl8125_cancel_schedule_esd_work(struct rtl8125_private *tp) +static void rtl8126_cancel_schedule_esd_work(struct rtl8126_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); } -static void rtl8125_schedule_linkchg_work(struct rtl8125_private *tp) +static void rtl8126_schedule_linkchg_work(struct rtl8126_private *tp) { - set_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); + set_bit(R8126_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags); schedule_delayed_work(&tp->linkchg_task, 4); } -static void rtl8125_cancel_schedule_linkchg_work(struct rtl8125_private *tp) +static void rtl8126_cancel_schedule_linkchg_work(struct rtl8126_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); } #endif -static void rtl8125_init_all_schedule_work(struct rtl8125_private *tp) +static void rtl8126_init_all_schedule_work(struct rtl8126_private *tp) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - INIT_WORK(&tp->reset_task, rtl8125_reset_task, dev); - INIT_WORK(&tp->esd_task, rtl8125_esd_task, dev); - INIT_WORK(&tp->linkchg_task, rtl8125_linkchg_task, dev); + INIT_WORK(&tp->reset_task, rtl8126_reset_task, dev); + INIT_WORK(&tp->esd_task, rtl8126_esd_task, dev); + INIT_WORK(&tp->linkchg_task, rtl8126_linkchg_task, dev); #else - INIT_DELAYED_WORK(&tp->reset_task, rtl8125_reset_task); - INIT_DELAYED_WORK(&tp->esd_task, rtl8125_esd_task); - INIT_DELAYED_WORK(&tp->linkchg_task, rtl8125_linkchg_task); + INIT_DELAYED_WORK(&tp->reset_task, rtl8126_reset_task); + INIT_DELAYED_WORK(&tp->esd_task, rtl8126_esd_task); + INIT_DELAYED_WORK(&tp->linkchg_task, rtl8126_linkchg_task); #endif } -static void rtl8125_cancel_all_schedule_work(struct rtl8125_private *tp) +static void rtl8126_cancel_all_schedule_work(struct rtl8126_private *tp) { - rtl8125_cancel_schedule_reset_work(tp); - rtl8125_cancel_schedule_esd_work(tp); - rtl8125_cancel_schedule_linkchg_work(tp); + rtl8126_cancel_schedule_reset_work(tp); + rtl8126_cancel_schedule_esd_work(tp); + rtl8126_cancel_schedule_linkchg_work(tp); } static void -rtl8125_wait_for_irq_complete(struct rtl8125_private *tp) +rtl8126_wait_for_irq_complete(struct rtl8126_private *tp) { if (tp->features & RTL_FEATURE_MSIX) { int i; @@ -18930,111 +15439,102 @@ rtl8125_wait_for_irq_complete(struct rtl8125_private *tp) } void -_rtl8125_wait_for_quiescence(struct net_device *dev) +_rtl8126_wait_for_quiescence(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); /* Wait for any pending NAPI task to complete */ -#ifdef CONFIG_R8125_NAPI - rtl8125_disable_napi(tp); -#endif//CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI + rtl8126_disable_napi(tp); +#endif//CONFIG_R8126_NAPI #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,67) /* Give a racing hard_start_xmit a few cycles to complete. */ synchronize_net(); #endif - rtl8125_irq_mask_and_ack(tp); + rtl8126_irq_mask_and_ack(tp); - rtl8125_wait_for_irq_complete(tp); + rtl8126_wait_for_irq_complete(tp); } static void -rtl8125_wait_for_quiescence(struct net_device *dev) +rtl8126_wait_for_quiescence(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); //suppress unused variable (void)(tp); - _rtl8125_wait_for_quiescence(dev); + _rtl8126_wait_for_quiescence(dev); -#ifdef CONFIG_R8125_NAPI - rtl8125_enable_napi(tp); -#endif//CONFIG_R8125_NAPI -} - -static int rtl8125_rx_nostuck(struct rtl8125_private *tp) -{ - int i, ret = 1; - for (i = 0; i < tp->num_rx_rings; i++) - ret &= (tp->rx_ring[i].dirty_rx == tp->rx_ring[i].cur_rx); - return ret; +#ifdef CONFIG_R8126_NAPI + rtl8126_enable_napi(tp); +#endif//CONFIG_R8126_NAPI } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_reset_task(void *_data) +static void rtl8126_reset_task(void *_data) { struct net_device *dev = _data; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); #else -static void rtl8125_reset_task(struct work_struct *work) +static void rtl8126_reset_task(struct work_struct *work) { - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, reset_task.work); + struct rtl8126_private *tp = + container_of(work, struct rtl8126_private, reset_task.work); struct net_device *dev = tp->dev; #endif - u32 budget = ~(u32)0; int i; rtnl_lock(); if (!netif_running(dev) || - test_bit(R8125_FLAG_DOWN, tp->task_flags) || - !test_and_clear_bit(R8125_FLAG_TASK_RESET_PENDING, tp->task_flags)) + test_bit(R8126_FLAG_DOWN, tp->task_flags) || + !test_and_clear_bit(R8126_FLAG_TASK_RESET_PENDING, tp->task_flags)) goto out_unlock; - rtl8125_wait_for_quiescence(dev); - - for (i = 0; i < tp->num_rx_rings; i++) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], &budget); -#else - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - } + netdev_err(dev, "Device reseting!\n"); netif_carrier_off(dev); netif_tx_disable(dev); - rtl8125_hw_reset(dev); + _rtl8126_wait_for_quiescence(dev); + rtl8126_hw_reset(dev); - rtl8125_tx_clear(tp); + rtl8126_tx_clear(tp); + + rtl8126_init_ring_indexes(tp); + + rtl8126_tx_desc_init(tp); + for (i = 0; i < tp->num_rx_rings; i++) { + struct rtl8126_rx_ring *ring; + u32 entry; + + ring = &tp->rx_ring[i]; + for (entry = 0; entry < ring->num_rx_desc; entry++) { + struct RxDesc *desc; + + desc = rtl8126_get_rxdesc(tp, ring->RxDescArray, entry); + rtl8126_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); + rtl8126_ptp_reset(tp); #endif - if (tp->resume_not_chg_speed) { - _rtl8125_check_link_status(dev); - tp->resume_not_chg_speed = 0; - } else { - rtl8125_enable_hw_linkchg_interrupt(tp); +#ifdef CONFIG_R8126_NAPI + rtl8126_enable_napi(tp); +#endif //CONFIG_R8126_NAPI - rtl8125_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); - } + if (tp->resume_not_chg_speed) { + _rtl8126_check_link_status(dev); + + tp->resume_not_chg_speed = 0; } else { - if (unlikely(net_ratelimit())) { - struct rtl8125_private *tp = netdev_priv(dev); + rtl8126_enable_hw_linkchg_interrupt(tp); - if (netif_msg_intr(tp)) { - printk(PFX KERN_EMERG - "%s: Rx buffers shortage\n", dev->name); - } - } - rtl8125_schedule_reset_work(tp); + rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); } out_unlock: @@ -19042,52 +15542,52 @@ out_unlock: } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_esd_task(void *_data) +static void rtl8126_esd_task(void *_data) { struct net_device *dev = _data; - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); #else -static void rtl8125_esd_task(struct work_struct *work) +static void rtl8126_esd_task(struct work_struct *work) { - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, esd_task.work); + struct rtl8126_private *tp = + container_of(work, struct rtl8126_private, esd_task.work); struct net_device *dev = tp->dev; #endif rtnl_lock(); if (!netif_running(dev) || - test_bit(R8125_FLAG_DOWN, tp->task_flags) || - !test_and_clear_bit(R8125_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags)) + test_bit(R8126_FLAG_DOWN, tp->task_flags) || + !test_and_clear_bit(R8126_FLAG_TASK_ESD_CHECK_PENDING, tp->task_flags)) goto out_unlock; - rtl8125_esd_checker(tp); + rtl8126_esd_checker(tp); - rtl8125_schedule_esd_work(tp); + rtl8126_schedule_esd_work(tp); out_unlock: rtnl_unlock(); } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -static void rtl8125_linkchg_task(void *_data) +static void rtl8126_linkchg_task(void *_data) { struct net_device *dev = _data; - //struct rtl8125_private *tp = netdev_priv(dev); + //struct rtl8126_private *tp = netdev_priv(dev); #else -static void rtl8125_linkchg_task(struct work_struct *work) +static void rtl8126_linkchg_task(struct work_struct *work) { - struct rtl8125_private *tp = - container_of(work, struct rtl8125_private, linkchg_task.work); + struct rtl8126_private *tp = + container_of(work, struct rtl8126_private, linkchg_task.work); struct net_device *dev = tp->dev; #endif rtnl_lock(); if (!netif_running(dev) || - test_bit(R8125_FLAG_DOWN, tp->task_flags) || - !test_and_clear_bit(R8125_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags)) + test_bit(R8126_FLAG_DOWN, tp->task_flags) || + !test_and_clear_bit(R8126_FLAG_TASK_LINKCHG_CHECK_PENDING, tp->task_flags)) goto out_unlock; - rtl8125_check_link_status(dev); + rtl8126_check_link_status(dev); out_unlock: rtnl_unlock(); @@ -19095,20 +15595,22 @@ out_unlock: #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) static void -rtl8125_tx_timeout(struct net_device *dev, unsigned int txqueue) +rtl8126_tx_timeout(struct net_device *dev, unsigned int txqueue) #else static void -rtl8125_tx_timeout(struct net_device *dev) +rtl8126_tx_timeout(struct net_device *dev) #endif { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_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); + rtl8126_schedule_reset_work(tp); } static u32 -rtl8125_get_txd_opts1(struct rtl8125_tx_ring *ring, +rtl8126_get_txd_opts1(struct rtl8126_tx_ring *ring, u32 opts1, u32 len, unsigned int entry) @@ -19122,8 +15624,8 @@ rtl8125_get_txd_opts1(struct rtl8125_tx_ring *ring, } static int -rtl8125_xmit_frags(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring, +rtl8126_xmit_frags(struct rtl8126_private *tp, + struct rtl8126_tx_ring *ring, struct sk_buff *skb, const u32 *opts) { @@ -19151,42 +15653,6 @@ rtl8125_xmit_frags(struct rtl8125_private *tp, len = skb_frag_size(frag); addr = skb_frag_address(frag); #endif - if (tp->RequireLSOPatch && - (cur_frag == nr_frags - 1) && - (opts[0] & (GiantSendv4|GiantSendv6)) && - PktLenCnt < ETH_FRAME_LEN && - len > 1) { - len -= 1; - mapping = dma_map_single(tp_to_dev(tp), addr, len, DMA_TO_DEVICE); - - if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { - if (unlikely(net_ratelimit())) - netif_err(tp, drv, tp->dev, - "Failed to map TX fragments DMA!\n"); - goto err_out; - } - - /* anti gcc 2.95.3 bugware (sic) */ - status = rtl8125_get_txd_opts1(ring, opts[0], len, entry); - - txd->addr = cpu_to_le64(mapping); - - ring->tx_skb[entry].len = len; - - txd->opts2 = cpu_to_le32(opts[1]); - wmb(); - txd->opts1 = cpu_to_le32(status); - - //second txd - addr += len; - len = 1; - entry = (entry + 1) % ring->num_tx_desc; - txd = ring->TxDescArray + entry; - cur_frag += 1; - - LsoPatchEnabled = TRUE; - } - mapping = dma_map_single(tp_to_dev(tp), addr, len, DMA_TO_DEVICE); if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { @@ -19197,7 +15663,7 @@ rtl8125_xmit_frags(struct rtl8125_private *tp, } /* anti gcc 2.95.3 bugware (sic) */ - status = rtl8125_get_txd_opts1(ring, opts[0], len, entry); + status = rtl8126_get_txd_opts1(ring, opts[0], len, entry); if (cur_frag == (nr_frags - 1) || LsoPatchEnabled == TRUE) status |= LastFrag; @@ -19215,7 +15681,7 @@ rtl8125_xmit_frags(struct rtl8125_private *tp, return cur_frag; err_out: - rtl8125_tx_clear_range(tp, ring, ring->cur_tx + 1, cur_frag); + rtl8126_tx_clear_range(tp, ring, ring->cur_tx + 1, cur_frag); return -EIO; } @@ -19237,7 +15703,7 @@ __be16 get_protocol(struct sk_buff *skb) } static inline -u8 rtl8125_get_l4_protocol(struct sk_buff *skb) +u8 rtl8126_get_l4_protocol(struct sk_buff *skb) { int no = skb_network_offset(skb); struct ipv6hdr *i6h, _i6h; @@ -19260,7 +15726,7 @@ u8 rtl8125_get_l4_protocol(struct sk_buff *skb) return ip_protocol; } -static bool rtl8125_skb_pad_with_len(struct sk_buff *skb, unsigned int len) +static bool rtl8126_skb_pad_with_len(struct sk_buff *skb, unsigned int len) { if (skb_padto(skb, len)) return false; @@ -19268,10 +15734,10 @@ static bool rtl8125_skb_pad_with_len(struct sk_buff *skb, unsigned int len) return true; } -static bool rtl8125_skb_pad(struct sk_buff *skb) +static bool rtl8126_skb_pad(struct sk_buff *skb) { #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) - return rtl8125_skb_pad_with_len(skb, ETH_ZLEN); + return rtl8126_skb_pad_with_len(skb, ETH_ZLEN); #else return !eth_skb_pad(skb); #endif @@ -19302,11 +15768,9 @@ static int msdn_giant_send_check(struct sk_buff *skb) } #endif -static bool rtl8125_require_pad_ptp_pkt(struct rtl8125_private *tp) +static bool rtl8126_require_pad_ptp_pkt(struct rtl8126_private *tp) { switch (tp->mcfg) { - case CFG_METHOD_2 ... CFG_METHOD_7: - return true; default: return false; } @@ -19314,7 +15778,7 @@ static bool rtl8125_require_pad_ptp_pkt(struct rtl8125_private *tp) #define MIN_PATCH_LEN (47) static u32 -rtl8125_get_patch_pad_len(struct rtl8125_private *tp, +rtl8126_get_patch_pad_len(struct rtl8126_private *tp, struct sk_buff *skb) { u32 pad_len = 0; @@ -19324,13 +15788,13 @@ 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)) + if (!rtl8126_require_pad_ptp_pkt(tp)) goto no_padding; if (!(has_trans && (pkt_len < 175))) //128 + MIN_PATCH_LEN goto no_padding; - ip_protocol = rtl8125_get_l4_protocol(skb); + ip_protocol = rtl8126_get_l4_protocol(skb); if (!(ip_protocol == IPPROTO_TCP || ip_protocol == IPPROTO_UDP)) goto no_padding; @@ -19372,13 +15836,13 @@ no_padding: } static bool -rtl8125_tso_csum(struct sk_buff *skb, +rtl8126_tso_csum(struct sk_buff *skb, struct net_device *dev, u32 *opts, unsigned int *bytecount, unsigned short *gso_segs) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); unsigned long large_send = 0; u32 csum_cmd = 0; u8 sw_calc_csum = false; @@ -19507,10 +15971,10 @@ rtl8125_tso_csum(struct sk_buff *skb, } if (check_patch_required) { - u32 pad_len = rtl8125_get_patch_pad_len(tp, skb); + u32 pad_len = rtl8126_get_patch_pad_len(tp, skb); if (pad_len > 0) { - if (!rtl8125_skb_pad_with_len(skb, skb->len + pad_len)) + if (!rtl8126_skb_pad_with_len(skb, skb->len + pad_len)) return false; if (csum_cmd != 0) @@ -19521,7 +15985,7 @@ rtl8125_tso_csum(struct sk_buff *skb, if (skb->len < ETH_ZLEN) { if (tp->UseSwPaddingShortPkt || (tp->ShortPacketSwChecksum && csum_cmd != 0)) { - if (!rtl8125_skb_pad(skb)) + if (!rtl8126_skb_pad(skb)) return false; if (csum_cmd != 0) @@ -19543,8 +16007,8 @@ rtl8125_tso_csum(struct sk_buff *skb, return true; } -static bool rtl8125_tx_slots_avail(struct rtl8125_private *tp, - struct rtl8125_tx_ring *ring) +static bool rtl8126_tx_slots_avail(struct rtl8126_private *tp, + struct rtl8126_tx_ring *ring) { unsigned int slots_avail = READ_ONCE(ring->dirty_tx) + ring->num_tx_desc - READ_ONCE(ring->cur_tx); @@ -19554,16 +16018,28 @@ static bool rtl8125_tx_slots_avail(struct rtl8125_private *tp, } static inline u32 -rtl8125_fast_mod_mask(const u32 input, const u32 mask) +rtl8126_fast_mod_mask(const u32 input, const u32 mask) { return input > mask ? input & mask : input; } +static void rtl8126_doorbell(struct rtl8126_private *tp, + struct rtl8126_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, +rtl8126_start_xmit(struct sk_buff *skb, struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); unsigned int bytecount; unsigned short gso_segs; struct ring_info *last; @@ -19577,14 +16053,14 @@ rtl8125_start_xmit(struct sk_buff *skb, int frags; u8 EnableTxNoClose = tp->EnableTxNoClose; const u16 queue_mapping = skb_get_queue_mapping(skb); - struct rtl8125_tx_ring *ring; + struct rtl8126_tx_ring *ring; bool stop_queue; assert(queue_mapping < tp->num_tx_rings); ring = &tp->tx_ring[queue_mapping]; - if (unlikely(!rtl8125_tx_slots_avail(tp, ring))) { + if (unlikely(!rtl8126_tx_slots_avail(tp, ring))) { if (netif_msg_drv(tp)) { printk(KERN_ERR "%s: BUG! Tx Ring[%d] full when queue awake!\n", @@ -19612,12 +16088,12 @@ rtl8125_start_xmit(struct sk_buff *skb, gso_segs = 1; opts[0] = DescOwn; - opts[1] = rtl8125_tx_vlan_tag(tp, skb); + opts[1] = rtl8126_tx_vlan_tag(tp, skb); - if (unlikely(!rtl8125_tso_csum(skb, dev, opts, &bytecount, &gso_segs))) + if (unlikely(!rtl8126_tso_csum(skb, dev, opts, &bytecount, &gso_segs))) goto err_dma_0; - frags = rtl8125_xmit_frags(tp, ring, skb, opts); + frags = rtl8126_xmit_frags(tp, ring, skb, opts); if (unlikely(frags < 0)) goto err_dma_0; if (frags) { @@ -19628,7 +16104,7 @@ rtl8125_start_xmit(struct sk_buff *skb, opts[0] |= FirstFrag | LastFrag; } - opts[0] = rtl8125_get_txd_opts1(ring, opts[0], len, entry); + opts[0] = rtl8126_get_txd_opts1(ring, opts[0], len, entry); mapping = dma_map_single(tp_to_dev(tp), skb->data, len, DMA_TO_DEVICE); if (unlikely(dma_mapping_error(tp_to_dev(tp), mapping))) { if (unlikely(net_ratelimit())) @@ -19638,7 +16114,7 @@ rtl8125_start_xmit(struct sk_buff *skb, #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 (!test_and_set_bit_lock(__RTL8126_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; @@ -19679,7 +16155,7 @@ rtl8125_start_xmit(struct sk_buff *skb, WRITE_ONCE(ring->cur_tx, ring->cur_tx + frags + 1); - stop_queue = !rtl8125_tx_slots_avail(tp, ring); + stop_queue = !rtl8126_tx_slots_avail(tp, ring); if (unlikely(stop_queue)) { /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must * not miss a ring update when it notices a stopped queue. @@ -19688,15 +16164,8 @@ rtl8125_start_xmit(struct sk_buff *skb, netif_stop_subqueue(dev, queue_mapping); } - if (netif_xmit_stopped(txring_txq(ring)) || !netdev_xmit_more()) { - if (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 */ - } + if (netif_xmit_stopped(txring_txq(ring)) || !netdev_xmit_more()) + rtl8126_doorbell(tp, ring); if (unlikely(stop_queue)) { /* Sync with rtl_tx: @@ -19707,13 +16176,13 @@ rtl8125_start_xmit(struct sk_buff *skb, * can't. */ smp_mb(); - if (rtl8125_tx_slots_avail(tp, ring)) + if (rtl8126_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); + rtl8126_tx_clear_range(tp, ring, ring->cur_tx + 1, frags); err_dma_0: RTLDEV->stats.tx_dropped++; dev_kfree_skb_any(skb); @@ -19726,39 +16195,20 @@ err_stop: goto out; } -static u32 -rtl8125_get_hw_clo_ptr(struct rtl8125_tx_ring *ring) -{ - struct rtl8125_private *tp = ring->priv; - - switch (tp->HwSuppTxNoCloseVer) { - case 3: - return RTL_R16(tp, ring->hw_clo_ptr_reg); - case 4: - case 5: - 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; - } -} - /* recycle tx no close desc*/ static int -rtl8125_tx_interrupt_noclose(struct rtl8125_tx_ring *ring, int budget) +rtl8126_tx_interrupt_noclose(struct rtl8126_tx_ring *ring, int budget) { unsigned int total_bytes = 0, total_packets = 0; - struct rtl8125_private *tp = ring->priv; + struct rtl8126_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->NextHwDesCloPtr = rtl8126_get_hw_clo_ptr(ring); + tx_desc_closed = rtl8126_fast_mod_mask(ring->NextHwDesCloPtr - ring->BeginHwDesCloPtr, tp->MaxTxDescPtrMask); tx_left = min((READ_ONCE(ring->cur_tx) - dirty_tx), tx_desc_closed); @@ -19768,7 +16218,7 @@ rtl8125_tx_interrupt_noclose(struct rtl8125_tx_ring *ring, int budget) 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, + rtl8126_unmap_tx_skb(tp->pci_dev, tx_skb, ring->TxDescArray + entry); @@ -19797,7 +16247,7 @@ rtl8125_tx_interrupt_noclose(struct rtl8125_tx_ring *ring, int budget) WRITE_ONCE(ring->dirty_tx, dirty_tx); smp_wmb(); if (__netif_subqueue_stopped(dev, ring->index) && - (rtl8125_tx_slots_avail(tp, ring))) { + (rtl8126_tx_slots_avail(tp, ring))) { netif_start_subqueue(dev, ring->index); } } @@ -19807,15 +16257,15 @@ rtl8125_tx_interrupt_noclose(struct rtl8125_tx_ring *ring, int budget) /* recycle tx close desc*/ static int -rtl8125_tx_interrupt_close(struct rtl8125_tx_ring *ring, int budget) +rtl8126_tx_interrupt_close(struct rtl8126_tx_ring *ring, int budget) { unsigned int total_bytes = 0, total_packets = 0; - struct rtl8125_private *tp = ring->priv; + struct rtl8126_private *tp = ring->priv; struct net_device *dev = tp->dev; unsigned int dirty_tx, tx_left; unsigned int count = 0; - dirty_tx = ring->dirty_tx;; + dirty_tx = ring->dirty_tx; tx_left = READ_ONCE(ring->cur_tx) - dirty_tx; while (tx_left > 0) { @@ -19825,7 +16275,7 @@ rtl8125_tx_interrupt_close(struct rtl8125_tx_ring *ring, int budget) if (le32_to_cpu(ring->TxDescArray[entry].opts1) & DescOwn) break; - rtl8125_unmap_tx_skb(tp->pci_dev, + rtl8126_unmap_tx_skb(tp->pci_dev, tx_skb, ring->TxDescArray + entry); @@ -19854,52 +16304,64 @@ rtl8125_tx_interrupt_close(struct rtl8125_tx_ring *ring, int budget) WRITE_ONCE(ring->dirty_tx, dirty_tx); smp_wmb(); if (__netif_subqueue_stopped(dev, ring->index) && - (rtl8125_tx_slots_avail(tp, ring))) { + (rtl8126_tx_slots_avail(tp, ring))) { netif_start_subqueue(dev, ring->index); } if (ring->cur_tx != dirty_tx) - RTL_W16(tp, TPPOLL_8125, BIT(ring->index)); + rtl8126_doorbell(tp, ring); } return count; } static int -rtl8125_tx_interrupt(struct rtl8125_tx_ring *ring, int budget) +rtl8126_tx_interrupt(struct rtl8126_tx_ring *ring, int budget) { - struct rtl8125_private *tp = ring->priv; + struct rtl8126_private *tp = ring->priv; if (tp->EnableTxNoClose) - return rtl8125_tx_interrupt_noclose(ring, budget); + return rtl8126_tx_interrupt_noclose(ring, budget); else - return rtl8125_tx_interrupt_close(ring, budget); + return rtl8126_tx_interrupt_close(ring, budget); } static int -rtl8125_tx_interrupt_with_vector(struct rtl8125_private *tp, +rtl8126_tx_interrupt_with_vector(struct rtl8126_private *tp, const int message_id, int budget) { int count = 0; - if (tp->HwCurrIsrVer == 3) { + switch (tp->HwCurrIsrVer) { + case 3: + case 4: if (message_id < tp->num_tx_rings) - count += rtl8125_tx_interrupt(&tp->tx_ring[message_id], budget); - } else { + count += rtl8126_tx_interrupt(&tp->tx_ring[message_id], budget); + break; + case 5: if (message_id == 16) - count += rtl8125_tx_interrupt(&tp->tx_ring[0], budget); + count += rtl8126_tx_interrupt(&tp->tx_ring[0], budget); +#ifdef ENABLE_MULTIPLE_TX_QUEUE + else if (message_id == 17) + count += rtl8126_tx_interrupt(&tp->tx_ring[1], budget); +#endif + break; + default: + if (message_id == 16) + count += rtl8126_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); + count += rtl8126_tx_interrupt(&tp->tx_ring[1], budget); #endif + break; } return count; } static inline int -rtl8125_fragmented_frame(struct rtl8125_private *tp, u32 status) +rtl8126_fragmented_frame(struct rtl8126_private *tp, u32 status) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) return (status & (FirstFrag_V3 | LastFrag_V3)) != (FirstFrag_V3 | LastFrag_V3); @@ -19908,7 +16370,7 @@ rtl8125_fragmented_frame(struct rtl8125_private *tp, u32 status) } static inline int -rtl8125_is_non_eop(struct rtl8125_private *tp, u32 status) +rtl8126_is_non_eop(struct rtl8126_private *tp, u32 status) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) return !(status & LastFrag_V3); @@ -19917,13 +16379,13 @@ rtl8125_is_non_eop(struct rtl8125_private *tp, u32 status) } static inline int -rtl8125_rx_desc_type(u32 status) +rtl8126_rx_desc_type(u32 status) { return ((status >> 26) & 0x0F); } static inline void -rtl8125_rx_v3_csum(struct rtl8125_private *tp, +rtl8126_rx_v3_csum(struct rtl8126_private *tp, struct sk_buff *skb, struct RxDescV3 *descv3) { @@ -19938,13 +16400,13 @@ rtl8125_rx_v3_csum(struct rtl8125_private *tp, } static inline void -rtl8125_rx_csum(struct rtl8125_private *tp, +rtl8126_rx_csum(struct rtl8126_private *tp, struct sk_buff *skb, struct RxDesc *desc, u32 opts1) { if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - rtl8125_rx_v3_csum(tp, skb, (struct RxDescV3 *)desc); + rtl8126_rx_v3_csum(tp, skb, (struct RxDescV3 *)desc); else { /* rx csum offload for RTL8125 */ if (((opts1 & RxTCPT) && !(opts1 & RxTCPF)) || @@ -19957,8 +16419,8 @@ rtl8125_rx_csum(struct rtl8125_private *tp, /* static inline int -rtl8125_try_rx_copy(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_try_rx_copy(struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, struct sk_buff **sk_buff, int pkt_size, struct RxDesc *desc, @@ -19968,19 +16430,19 @@ rtl8125_try_rx_copy(struct rtl8125_private *tp, struct sk_buff *skb; - skb = RTL_ALLOC_SKB_INTR(&tp->r8125napi[ring->index].napi, pkt_size + R8125_RX_ALIGN); + skb = RTL_ALLOC_SKB_INTR(&tp->r8126napi[ring->index].napi, pkt_size + R8126_RX_ALIGN); if (skb) { u8 *data; data = sk_buff[0]->data; - if (!R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); + if (!R8126_USE_NAPI_ALLOC_SKB) + skb_reserve(skb, R8126_RX_ALIGN); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) - prefetch(data - R8125_RX_ALIGN); + prefetch(data - R8126_RX_ALIGN); #endif eth_copy_and_sum(skb, data, pkt_size, 0); *sk_buff = skb; - rtl8125_mark_to_asic(tp, desc, rx_buf_sz); + rtl8126_mark_to_asic(tp, desc, rx_buf_sz); ret = 0; } @@ -19989,15 +16451,15 @@ rtl8125_try_rx_copy(struct rtl8125_private *tp, */ static inline void -rtl8125_rx_skb(struct rtl8125_private *tp, +rtl8126_rx_skb(struct rtl8126_private *tp, struct sk_buff *skb, u32 ring_index) { -#ifdef CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) netif_receive_skb(skb); #else - napi_gro_receive(&tp->r8125napi[ring_index].napi, skb); + napi_gro_receive(&tp->r8126napi[ring_index].napi, skb); #endif #else netif_rx(skb); @@ -20005,8 +16467,8 @@ rtl8125_rx_skb(struct rtl8125_private *tp, } static int -rtl8125_check_rx_desc_error(struct net_device *dev, - struct rtl8125_private *tp, +rtl8126_check_rx_desc_error(struct net_device *dev, + struct rtl8126_private *tp, u32 status) { int ret = 0; @@ -20037,16 +16499,16 @@ rtl8125_check_rx_desc_error(struct net_device *dev, #ifdef ENABLE_PAGE_REUSE static inline bool -rtl8125_reuse_rx_ok(struct page *page) +rtl8126_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"); + //printk(KERN_INFO "r8126 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)); + //printk(KERN_INFO "r8126 page refcnt %d, can't reuse!\n", page_ref_count(page)); return false; } @@ -20054,13 +16516,13 @@ rtl8125_reuse_rx_ok(struct page *page) } static void -rtl8125_reuse_rx_buffer(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring, u32 cur_rx, struct rtl8125_rx_buffer *rxb) +rtl8126_reuse_rx_buffer(struct rtl8126_private *tp, struct rtl8126_rx_ring *ring, u32 cur_rx, struct rtl8126_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]; + struct rtl8126_rx_buffer *nrxb = &ring->rx_buffer[entry]; u32 noffset; @@ -20081,20 +16543,20 @@ rtl8125_reuse_rx_buffer(struct rtl8125_private *tp, struct rtl8125_rx_ring *ring } } -static void rtl8125_put_rx_buffer(struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +static void rtl8126_put_rx_buffer(struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, u32 cur_rx, - struct rtl8125_rx_buffer *rxb) + struct rtl8126_rx_buffer *rxb) { - struct rtl8125_rx_buffer *nrxb; + struct rtl8126_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))) { + if (likely(rtl8126_reuse_rx_ok(page))) { /* hand second half of page back to the ring */ - rtl8125_reuse_rx_buffer(tp, ring, cur_rx, rxb); + rtl8126_reuse_rx_buffer(tp, ring, cur_rx, rxb); } else { tp->page_reuse_fail_cnt++; @@ -20114,7 +16576,8 @@ static void rtl8125_put_rx_buffer(struct rtl8125_private *tp, tp->rx_buf_sz, DMA_FROM_DEVICE); - rtl8125_map_to_asic(tp, ring, ring->RxDescArray + entry, + rtl8126_map_to_asic(tp, ring, + rtl8126_get_rxdesc(tp, ring->RxDescArray, entry), nrxb->dma + nrxb->page_offset, tp->rx_buf_sz, entry); @@ -20124,9 +16587,9 @@ static void rtl8125_put_rx_buffer(struct rtl8125_private *tp, #endif //ENABLE_PAGE_REUSE static int -rtl8125_rx_interrupt(struct net_device *dev, - struct rtl8125_private *tp, - struct rtl8125_rx_ring *ring, +rtl8126_rx_interrupt(struct net_device *dev, + struct rtl8126_private *tp, + struct rtl8126_rx_ring *ring, napi_budget budget) { unsigned int cur_rx, rx_left; @@ -20138,7 +16601,7 @@ rtl8125_rx_interrupt(struct net_device *dev, u32 rx_quota; u32 ring_index = ring->index; #ifdef ENABLE_PAGE_REUSE - struct rtl8125_rx_buffer *rxb; + struct rtl8126_rx_buffer *rxb; #else //ENABLE_PAGE_REUSE u64 rx_buf_phy_addr; #endif //ENABLE_PAGE_REUSE @@ -20154,7 +16617,7 @@ rtl8125_rx_interrupt(struct net_device *dev, rx_quota = RTL_RX_QUOTA(budget); cur_rx = ring->cur_rx; rx_left = ring->num_rx_desc + ring->dirty_rx - cur_rx; - rx_left = rtl8125_rx_quota(rx_left, (u32)rx_quota); + rx_left = rtl8126_rx_quota(rx_left, (u32)rx_quota); for (; rx_left > 0; rx_left--, cur_rx++) { #ifdef ENABLE_PTP_SUPPORT @@ -20167,15 +16630,15 @@ rtl8125_rx_interrupt(struct net_device *dev, u32 pkt_size; entry = cur_rx % ring->num_rx_desc; - desc = rtl8125_get_rxdesc(tp, ring->RxDescArray, entry); - status = le32_to_cpu(rtl8125_rx_desc_opts1(tp, desc)); + desc = rtl8126_get_rxdesc(tp, ring->RxDescArray, entry); + status = le32_to_cpu(rtl8126_rx_desc_opts1(tp, desc)); if (status & DescOwn) break; rmb(); - if (unlikely(rtl8125_check_rx_desc_error(dev, tp, status) < 0)) { + if (unlikely(rtl8126_check_rx_desc_error(dev, tp, status) < 0)) { if (netif_msg_rx_err(tp)) { printk(KERN_INFO "%s: Rx ERROR. status = %08x\n", @@ -20190,7 +16653,7 @@ rtl8125_rx_interrupt(struct net_device *dev, pkt_size = status & 0x00003fff; if (likely(!(dev->features & NETIF_F_RXFCS))) { #ifdef ENABLE_RX_PACKET_FRAGMENT - if (rtl8125_is_non_eop(tp, status) && + if (rtl8126_is_non_eop(tp, status) && pkt_size == tp->rx_buf_sz) { struct RxDesc *desc_next; unsigned int entry_next; @@ -20198,8 +16661,8 @@ rtl8125_rx_interrupt(struct net_device *dev, 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)); + desc_next = rtl8126_get_rxdesc(tp, ring->RxDescArray, entry_next); + status_next = le32_to_cpu(rtl8126_rx_desc_opts1(tp, desc_next)); if (!(status_next & DescOwn)) { pkt_size_next = status_next & 0x00003fff; if (pkt_size_next < ETH_FCS_LEN) @@ -20207,7 +16670,7 @@ rtl8125_rx_interrupt(struct net_device *dev, } } #endif //ENABLE_RX_PACKET_FRAGMENT - if (!rtl8125_is_non_eop(tp, status)) { + if (!rtl8126_is_non_eop(tp, status)) { if (pkt_size < ETH_FCS_LEN) { #ifdef ENABLE_RX_PACKET_FRAGMENT pkt_size = 0; @@ -20228,13 +16691,13 @@ rtl8125_rx_interrupt(struct net_device *dev, * frames. They are seen as a symptom of over-mtu * sized frames. */ - if (unlikely(rtl8125_fragmented_frame(tp, status))) + if (unlikely(rtl8126_fragmented_frame(tp, status))) goto drop_packet; #endif //!ENABLE_RX_PACKET_FRAGMENT || !ENABLE_PAGE_REUSE #ifdef ENABLE_PTP_SUPPORT if (tp->EnablePtp) { - desc_type = rtl8125_rx_desc_type(status); + desc_type = rtl8126_rx_desc_type(status); if (desc_type == RXDESC_TYPE_NEXT && rx_left > 0) { u32 status_next; struct RxDescV3 *desc_next; @@ -20243,7 +16706,7 @@ rtl8125_rx_interrupt(struct net_device *dev, cur_rx++; rx_left--; entry_next = cur_rx % ring->num_rx_desc; - desc_next = (struct RxDescV3 *)rtl8125_get_rxdesc(tp, ring->RxDescArray, entry_next); + desc_next = (struct RxDescV3 *)rtl8126_get_rxdesc(tp, ring->RxDescArray, entry_next); status_next = le32_to_cpu(desc_next->RxDescNormalDDWord4.opts1); if (unlikely(status_next & DescOwn)) { udelay(1); @@ -20254,30 +16717,30 @@ rtl8125_rx_interrupt(struct net_device *dev, "%s: Rx Next Desc ERROR. status = %08x\n", dev->name, status_next); } - rtl8125_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, + rtl8126_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); + rtl8126_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); goto drop_packet; } } rmb(); - desc_type = rtl8125_rx_desc_type(status_next); + desc_type = rtl8126_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, + rtl8126_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); + rtl8126_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, + rtl8126_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); + rtl8126_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); goto drop_packet; } } else @@ -20296,18 +16759,18 @@ rtl8125_rx_interrupt(struct net_device *dev, } skb->dev = dev; - if (!R8125_USE_NAPI_ALLOC_SKB) - skb_reserve(skb, R8125_RX_ALIGN); + if (!R8126_USE_NAPI_ALLOC_SKB) + skb_reserve(skb, R8126_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); + rtl8126_rx_ptp_pktstamp(tp, skb, &ptp_desc); #endif //ENABLE_PTP_SUPPORT //recycle desc - rtl8125_put_rx_buffer(tp, ring, cur_rx, rxb); + rtl8126_put_rx_buffer(tp, ring, cur_rx, rxb); dma_sync_single_range_for_cpu(tp_to_dev(tp), rxb->dma, @@ -20315,19 +16778,19 @@ rtl8125_rx_interrupt(struct net_device *dev, 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); + skb = RTL_ALLOC_SKB_INTR(&tp->r8126napi[ring->index].napi, pkt_size + R8126_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); + if (!R8126_USE_NAPI_ALLOC_SKB) + skb_reserve(skb, R8126_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); + rtl8126_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), @@ -20335,7 +16798,7 @@ rtl8125_rx_interrupt(struct net_device *dev, 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); + prefetch(rx_buf - R8126_RX_ALIGN); #endif eth_copy_and_sum(skb, rx_buf, pkt_size, 0); @@ -20344,7 +16807,7 @@ rtl8125_rx_interrupt(struct net_device *dev, #endif //ENABLE_PAGE_REUSE #ifdef ENABLE_RX_PACKET_FRAGMENT - if (rtl8125_is_non_eop(tp, status)) { + if (rtl8126_is_non_eop(tp, status)) { unsigned int entry_next; entry_next = (entry + 1) % ring->num_rx_desc; rxb = &ring->rx_buffer[entry_next]; @@ -20354,9 +16817,9 @@ rtl8125_rx_interrupt(struct net_device *dev, #endif //ENABLE_RX_PACKET_FRAGMENT #ifdef ENABLE_RSS_SUPPORT - rtl8125_rx_hash(tp, (struct RxDescV3 *)desc, skb); + rtl8126_rx_hash(tp, (struct RxDescV3 *)desc, skb); #endif - rtl8125_rx_csum(tp, skb, desc, status); + rtl8126_rx_csum(tp, skb, desc, status); skb->protocol = eth_type_trans(skb, dev); @@ -20365,8 +16828,8 @@ rtl8125_rx_interrupt(struct net_device *dev, if (skb->pkt_type == PACKET_MULTICAST) total_rx_multicast_packets++; - if (rtl8125_rx_vlan_skb(tp, desc, skb) < 0) - rtl8125_rx_skb(tp, skb, ring_index); + if (rtl8126_rx_vlan_skb(tp, desc, skb) < 0) + rtl8126_rx_skb(tp, skb, ring_index); #if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0) dev->last_rx = jiffies; @@ -20380,11 +16843,11 @@ rtl8125_rx_interrupt(struct net_device *dev, release_descriptor: if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { - rtl8125_set_desc_dma_addr(tp, desc, + rtl8126_set_desc_dma_addr(tp, desc, ring->RxDescPhyAddr[entry]); wmb(); } - rtl8125_mark_to_asic(tp, desc, tp->rx_buf_sz); + rtl8126_mark_to_asic(tp, desc, tp->rx_buf_sz); continue; drop_packet: RTLDEV->stats.rx_dropped++; @@ -20395,7 +16858,7 @@ drop_packet: count = cur_rx - ring->cur_rx; ring->cur_rx = cur_rx; - delta = rtl8125_rx_fill(tp, ring, dev, ring->dirty_rx, ring->cur_rx, 1); + delta = rtl8126_rx_fill(tp, ring, dev, ring->dirty_rx, ring->cur_rx, 1); if (!delta && count && netif_msg_intr(tp)) printk(KERN_INFO "%s: no Rx buffer allocated\n", dev->name); ring->dirty_rx += delta; @@ -20419,12 +16882,32 @@ rx_out: } static bool -rtl8125_linkchg_interrupt(struct rtl8125_private *tp, u32 status) +rtl8126_linkchg_interrupt(struct rtl8126_private *tp, u32 status) { - if (tp->HwCurrIsrVer > 1) + switch (tp->HwCurrIsrVer) { + case 2: + case 3: return status & ISRIMR_V2_LINKCHG; + case 4: + return status & ISRIMR_V4_LINKCHG; + case 5: + return status & ISRIMR_V5_LINKCHG; + default: + return status & LinkChg; + } +} - return status & LinkChg; +static u32 +rtl8126_get_linkchg_message_id(struct rtl8126_private *tp) +{ + switch (tp->HwCurrIsrVer) { + case 4: + return 29; + case 5: + return 18; + default: + return 21; + } } /* @@ -20432,13 +16915,13 @@ rtl8125_linkchg_interrupt(struct rtl8125_private *tp, u32 status) *the Tx thread. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t rtl8126_interrupt(int irq, void *dev_instance, struct pt_regs *regs) #else -static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) +static irqreturn_t rtl8126_interrupt(int irq, void *dev_instance) #endif { - struct r8125_napi *r8125napi = dev_instance; - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = dev_instance; + struct rtl8126_private *tp = r8126napi->priv; struct net_device *dev = tp->dev; u32 status; int handled = 0; @@ -20464,12 +16947,12 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) if (!tp->irq_tbl[0].requested) break; #endif - rtl8125_disable_hw_interrupt(tp); + rtl8126_disable_hw_interrupt(tp); RTL_W32(tp, tp->isr_reg[0], status&~RxFIFOOver); - if (rtl8125_linkchg_interrupt(tp, status)) - rtl8125_schedule_linkchg_work(tp); + if (rtl8126_linkchg_interrupt(tp, status)) + rtl8126_schedule_linkchg_work(tp); #ifdef ENABLE_DASH_SUPPORT if (tp->DASH) { @@ -20495,19 +16978,19 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) } #endif -#ifdef CONFIG_R8125_NAPI +#ifdef CONFIG_R8126_NAPI if (status & tp->intr_mask || tp->keep_intr_cnt-- > 0) { if (status & tp->intr_mask) tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &tp->r8125napi[0].napi))) - __RTL_NETIF_RX_SCHEDULE(dev, &tp->r8125napi[0].napi); + if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &tp->r8126napi[0].napi))) + __RTL_NETIF_RX_SCHEDULE(dev, &tp->r8126napi[0].napi); else if (netif_msg_intr(tp)) printk(KERN_INFO "%s: interrupt %04x in poll\n", dev->name, status); } else { tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - rtl8125_switch_to_hw_interrupt(tp); + rtl8126_switch_to_hw_interrupt(tp); } #else if (status & tp->intr_mask || tp->keep_intr_cnt-- > 0) { @@ -20518,12 +17001,12 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; for (i = 0; i < tp->num_tx_rings; i++) - rtl8125_tx_interrupt(&tp->tx_ring[i], ~(u32)0); + rtl8126_tx_interrupt(&tp->tx_ring[i], ~(u32)0); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[0], &budget); + rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[0], &budget); #else - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[0], budget); + rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[0], budget); #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) #ifdef ENABLE_DASH_SUPPORT @@ -20534,10 +17017,10 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) } #endif - rtl8125_switch_to_timer_interrupt(tp); + rtl8126_switch_to_timer_interrupt(tp); } else { tp->keep_intr_cnt = RTK_KEEP_INTERRUPT_COUNT; - rtl8125_switch_to_hw_interrupt(tp); + rtl8126_switch_to_hw_interrupt(tp); } #endif } while (false); @@ -20546,16 +17029,16 @@ static irqreturn_t rtl8125_interrupt(int irq, void *dev_instance) } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t rtl8126_interrupt_msix(int irq, void *dev_instance, struct pt_regs *regs) #else -static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) +static irqreturn_t rtl8126_interrupt_msix(int irq, void *dev_instance) #endif { - struct r8125_napi *r8125napi = dev_instance; - struct rtl8125_private *tp = r8125napi->priv; + struct r8126_napi *r8126napi = dev_instance; + struct rtl8126_private *tp = r8126napi->priv; struct net_device *dev = tp->dev; - int message_id = r8125napi->index; -#ifndef CONFIG_R8125_NAPI + int message_id = r8126napi->index; +#ifndef CONFIG_R8126_NAPI u32 budget = ~(u32)0; #endif @@ -20565,33 +17048,33 @@ static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) break; #endif //link change - if (message_id == 21) { - rtl8125_disable_hw_interrupt_v2(tp, message_id); - rtl8125_clear_hw_isr_v2(tp, message_id); - rtl8125_schedule_linkchg_work(tp); + if (message_id == rtl8126_get_linkchg_message_id(tp)) { + rtl8126_disable_hw_interrupt_v2(tp, message_id); + rtl8126_clear_hw_isr_v2(tp, message_id); + rtl8126_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); - __RTL_NETIF_RX_SCHEDULE(dev, &r8125napi->napi); +#ifdef CONFIG_R8126_NAPI + if (likely(RTL_NETIF_RX_SCHEDULE_PREP(dev, &r8126napi->napi))) { + rtl8126_disable_hw_interrupt_v2(tp, message_id); + __RTL_NETIF_RX_SCHEDULE(dev, &r8126napi->napi); } 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); + rtl8126_clear_hw_isr_v2(tp, message_id); #else - rtl8125_tx_interrupt_with_vector(tp, message_id, ~(u32)0); + rtl8126_tx_interrupt_with_vector(tp, message_id, ~(u32)0); if (message_id < tp->num_rx_rings) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], &budget); + rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], &budget); #else - rtl8125_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); + rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) } - rtl8125_enable_hw_interrupt_v2(tp, message_id); + rtl8126_enable_hw_interrupt_v2(tp, message_id); #endif } while (false); @@ -20599,89 +17082,91 @@ static irqreturn_t rtl8125_interrupt_msix(int irq, void *dev_instance) return IRQ_HANDLED; } -static void rtl8125_down(struct net_device *dev) +static void rtl8126_down(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - //rtl8125_delete_esd_timer(dev, &tp->esd_timer); + //rtl8126_delete_esd_timer(dev, &tp->esd_timer); - //rtl8125_delete_link_timer(dev, &tp->link_timer); + //rtl8126_delete_link_timer(dev, &tp->link_timer); netif_carrier_off(dev); netif_tx_disable(dev); - _rtl8125_wait_for_quiescence(dev); + _rtl8126_wait_for_quiescence(dev); - rtl8125_hw_reset(dev); + rtl8126_hw_reset(dev); - rtl8125_tx_clear(tp); + rtl8126_tx_clear(tp); - rtl8125_rx_clear(tp); + rtl8126_rx_clear(tp); } -static int rtl8125_resource_freed(struct rtl8125_private *tp) +static int rtl8126_resource_freed(struct rtl8126_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; } -int rtl8125_close(struct net_device *dev) +int rtl8126_close(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); - if (!rtl8125_resource_freed(tp)) { - set_bit(R8125_FLAG_DOWN, tp->task_flags); + if (!rtl8126_resource_freed(tp)) { + set_bit(R8126_FLAG_DOWN, tp->task_flags); - rtl8125_down(dev); + rtl8126_down(dev); pci_clear_master(tp->pci_dev); #ifdef ENABLE_PTP_SUPPORT - rtl8125_ptp_stop(tp); + rtl8126_ptp_stop(tp); #endif - rtl8125_hw_d3_para(dev); + rtl8126_hw_d3_para(dev); - rtl8125_powerdown_pll(dev, 0); + rtl8126_powerdown_pll(dev, 0); - rtl8125_free_irq(tp); + rtl8126_free_irq(tp); - rtl8125_free_alloc_resources(tp); + rtl8126_free_alloc_resources(tp); } else { - rtl8125_hw_d3_para(dev); + rtl8126_hw_d3_para(dev); - rtl8125_powerdown_pll(dev, 0); + rtl8126_powerdown_pll(dev, 0); } return 0; } #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) -static void rtl8125_shutdown(struct pci_dev *pdev) +static void rtl8126_shutdown(struct pci_dev *pdev) { struct net_device *dev = pci_get_drvdata(pdev); - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); rtnl_lock(); if (HW_DASH_SUPPORT_DASH(tp)) - rtl8125_driver_stop(tp); + rtl8126_driver_stop(tp); if (s5_keep_curr_mac == 0 && tp->random_mac == 0) - rtl8125_rar_set(tp, tp->org_mac_addr); + rtl8126_rar_set(tp, tp->org_mac_addr); if (s5wol == 0) tp->wol_enabled = WOL_DISABLED; - rtl8125_close(dev); - rtl8125_disable_msi(pdev, tp); + rtl8126_close(dev); + rtl8126_disable_msi(pdev, tp); rtnl_unlock(); @@ -20697,13 +17182,13 @@ static void rtl8125_shutdown(struct pci_dev *pdev) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) static int -rtl8125_suspend(struct pci_dev *pdev, u32 state) +rtl8126_suspend(struct pci_dev *pdev, u32 state) #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) static int -rtl8125_suspend(struct device *device) +rtl8126_suspend(struct device *device) #else static int -rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) +rtl8126_suspend(struct pci_dev *pdev, pm_message_t state) #endif { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) @@ -20712,22 +17197,22 @@ rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) #else struct net_device *dev = pci_get_drvdata(pdev); #endif - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) u32 pci_pm_state = pci_choose_state(pdev, state); #endif if (!netif_running(dev)) goto out; - //rtl8125_cancel_all_schedule_work(tp); + //rtl8126_cancel_all_schedule_work(tp); - //rtl8125_delete_esd_timer(dev, &tp->esd_timer); + //rtl8126_delete_esd_timer(dev, &tp->esd_timer); - //rtl8125_delete_link_timer(dev, &tp->link_timer); + //rtl8126_delete_link_timer(dev, &tp->link_timer); rtnl_lock(); - set_bit(R8125_FLAG_DOWN, tp->task_flags); + set_bit(R8126_FLAG_DOWN, tp->task_flags); netif_carrier_off(dev); @@ -20736,18 +17221,18 @@ rtl8125_suspend(struct pci_dev *pdev, pm_message_t state) netif_device_detach(dev); #ifdef ENABLE_PTP_SUPPORT - rtl8125_ptp_suspend(tp); + rtl8126_ptp_suspend(tp); #endif - rtl8125_hw_reset(dev); + rtl8126_hw_reset(dev); pci_clear_master(pdev); - rtl8125_hw_d3_para(dev); + rtl8126_hw_d3_para(dev); - rtl8125_powerdown_pll(dev, 1); + rtl8126_powerdown_pll(dev, 1); if (HW_DASH_SUPPORT_DASH(tp)) - rtl8125_driver_stop(tp); + rtl8126_driver_stop(tp); rtnl_unlock(); out: @@ -20769,17 +17254,17 @@ out: } static int -rtl8125_hw_d3_not_power_off(struct net_device *dev) +rtl8126_hw_d3_not_power_off(struct net_device *dev) { - return rtl8125_check_hw_phy_mcu_code_ver(dev); + return rtl8126_check_hw_phy_mcu_code_ver(dev); } -static int rtl8125_wait_phy_nway_complete_sleep(struct rtl8125_private *tp) +static int rtl8126_wait_phy_nway_complete_sleep(struct rtl8126_private *tp) { int i, val; for (i = 0; i < 30; i++) { - val = rtl8125_mdio_read(tp, MII_BMSR) & BMSR_ANEGCOMPLETE; + val = rtl8126_mdio_read(tp, MII_BMSR) & BMSR_ANEGCOMPLETE; if (val) return 0; @@ -20791,10 +17276,10 @@ static int rtl8125_wait_phy_nway_complete_sleep(struct rtl8125_private *tp) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) static int -rtl8125_resume(struct pci_dev *pdev) +rtl8126_resume(struct pci_dev *pdev) #else static int -rtl8125_resume(struct device *device) +rtl8126_resume(struct device *device) #endif { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) @@ -20803,7 +17288,7 @@ rtl8125_resume(struct device *device) #else struct net_device *dev = pci_get_drvdata(pdev); #endif - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) u32 pci_pm_state = PCI_D0; #endif @@ -20824,13 +17309,13 @@ rtl8125_resume(struct device *device) pci_enable_wake(pdev, PCI_D0, 0); /* restore last modified mac address */ - rtl8125_rar_set(tp, dev->dev_addr); + rtl8126_rar_set(tp, dev->dev_addr); tp->resume_not_chg_speed = 0; if (tp->check_keep_link_speed && //tp->link_ok(dev) && - rtl8125_hw_d3_not_power_off(dev) && - rtl8125_wait_phy_nway_complete_sleep(tp) == 0) + rtl8126_hw_d3_not_power_off(dev) && + rtl8126_wait_phy_nway_complete_sleep(tp) == 0) tp->resume_not_chg_speed = 1; if (!netif_running(dev)) @@ -20838,18 +17323,18 @@ rtl8125_resume(struct device *device) pci_set_master(pdev); - rtl8125_exit_oob(dev); + rtl8126_exit_oob(dev); - rtl8125_up(dev); + rtl8126_up(dev); - clear_bit(R8125_FLAG_DOWN, tp->task_flags); + clear_bit(R8126_FLAG_DOWN, tp->task_flags); - rtl8125_schedule_reset_work(tp); + rtl8126_schedule_reset_work(tp); - rtl8125_schedule_esd_work(tp); + rtl8126_schedule_esd_work(tp); - //mod_timer(&tp->esd_timer, jiffies + RTL8125_ESD_TIMEOUT); - //mod_timer(&tp->link_timer, jiffies + RTL8125_LINK_TIMEOUT); + //mod_timer(&tp->esd_timer, jiffies + RTL8126_ESD_TIMEOUT); + //mod_timer(&tp->link_timer, jiffies + RTL8126_LINK_TIMEOUT); out_unlock: netif_device_attach(dev); @@ -20860,68 +17345,68 @@ out_unlock: #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29) -static struct dev_pm_ops rtl8125_pm_ops = { - .suspend = rtl8125_suspend, - .resume = rtl8125_resume, - .freeze = rtl8125_suspend, - .thaw = rtl8125_resume, - .poweroff = rtl8125_suspend, - .restore = rtl8125_resume, +static struct dev_pm_ops rtl8126_pm_ops = { + .suspend = rtl8126_suspend, + .resume = rtl8126_resume, + .freeze = rtl8126_suspend, + .thaw = rtl8126_resume, + .poweroff = rtl8126_suspend, + .restore = rtl8126_resume, }; -#define RTL8125_PM_OPS (&rtl8125_pm_ops) +#define RTL8126_PM_OPS (&rtl8126_pm_ops) #endif #else /* !CONFIG_PM */ -#define RTL8125_PM_OPS NULL +#define RTL8126_PM_OPS NULL #endif /* CONFIG_PM */ -static struct pci_driver rtl8125_pci_driver = { +static struct pci_driver rtl8126_pci_driver = { .name = MODULENAME, - .id_table = rtl8125_pci_tbl, - .probe = rtl8125_init_one, - .remove = __devexit_p(rtl8125_remove_one), + .id_table = rtl8126_pci_tbl, + .probe = rtl8126_init_one, + .remove = __devexit_p(rtl8126_remove_one), #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) - .shutdown = rtl8125_shutdown, + .shutdown = rtl8126_shutdown, #endif #ifdef CONFIG_PM #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) - .suspend = rtl8125_suspend, - .resume = rtl8125_resume, + .suspend = rtl8126_suspend, + .resume = rtl8126_resume, #else - .driver.pm = RTL8125_PM_OPS, + .driver.pm = RTL8126_PM_OPS, #endif #endif }; static int __init -rtl8125_init_module(void) +rtl8126_init_module(void) { int ret = 0; -#ifdef ENABLE_R8125_PROCFS - rtl8125_proc_module_init(); +#ifdef ENABLE_R8126_PROCFS + rtl8126_proc_module_init(); #endif #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - ret = pci_register_driver(&rtl8125_pci_driver); + ret = pci_register_driver(&rtl8126_pci_driver); #else - ret = pci_module_init(&rtl8125_pci_driver); + ret = pci_module_init(&rtl8126_pci_driver); #endif return ret; } static void __exit -rtl8125_cleanup_module(void) +rtl8126_cleanup_module(void) { - pci_unregister_driver(&rtl8125_pci_driver); + pci_unregister_driver(&rtl8126_pci_driver); -#ifdef ENABLE_R8125_PROCFS - if (rtl8125_proc) { +#ifdef ENABLE_R8126_PROCFS + if (rtl8126_proc) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) remove_proc_subtree(MODULENAME, init_net.proc_net); #else @@ -20931,10 +17416,10 @@ rtl8125_cleanup_module(void) remove_proc_entry(MODULENAME, proc_net); #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) - rtl8125_proc = NULL; + rtl8126_proc = NULL; } #endif } -module_init(rtl8125_init_module); -module_exit(rtl8125_cleanup_module); +module_init(rtl8126_init_module); +module_exit(rtl8126_cleanup_module); diff --git a/r8125_ptp.c b/r8126_ptp.c similarity index 79% rename from r8125_ptp.c rename to r8126_ptp.c index 2fb63cc..8743f5e 100644 --- a/r8125_ptp.c +++ b/r8126_ptp.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -42,8 +42,8 @@ #include #include -#include "r8125.h" -#include "r8125_ptp.h" +#include "r8126.h" +#include "r8126_ptp.h" #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) @@ -57,7 +57,7 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) } #endif -static int _rtl8125_phc_gettime(struct rtl8125_private *tp, struct timespec64 *ts64) +static int _rtl8126_phc_gettime(struct rtl8126_private *tp, struct timespec64 *ts64) { //get local time RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_LATCHED_LOCAL_TIME | PTP_EXEC_CMD)); @@ -75,7 +75,7 @@ static int _rtl8125_phc_gettime(struct rtl8125_private *tp, struct timespec64 *t return 0; } -static int _rtl8125_phc_settime(struct rtl8125_private *tp, const struct timespec64 *ts64) +static int _rtl8126_phc_settime(struct rtl8126_private *tp, const struct timespec64 *ts64) { /* nanoseconds */ //0x6808[29:0] @@ -92,7 +92,7 @@ static int _rtl8125_phc_settime(struct rtl8125_private *tp, const struct timespe return 0; } -static int _rtl8125_phc_adjtime(struct rtl8125_private *tp, s64 delta) +static int _rtl8126_phc_adjtime(struct rtl8126_private *tp, s64 delta) { struct timespec64 d; bool negative = false; @@ -141,15 +141,15 @@ static int _rtl8125_phc_adjtime(struct rtl8125_private *tp, s64 delta) return 0; } -static int rtl8125_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) +static int rtl8126_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) { - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); + struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); int ret; //netif_info(tp, drv, tp->dev, "phc adjust time\n"); rtnl_lock(); - ret = _rtl8125_phc_adjtime(tp, delta); + ret = _rtl8126_phc_adjtime(tp, delta); rtnl_unlock(); return ret; @@ -169,9 +169,9 @@ static int rtl8125_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) 8ns*10^(-9) = 8 * 2^30 sub_ns * 10^(-9) = 2^33 sub_ns * 10^(-9) = 8.59 sub_ns = 9 sub_ns */ -static int _rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb) +static int _rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb) { - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); + struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); bool negative = false; u32 sub_ns; @@ -199,54 +199,54 @@ static int _rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb) return 0; } -static int rtl8125_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) +static int rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) { - //struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); + //struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); //netif_info(tp, drv, tp->dev, "phc adjust freq\n"); if (delta > ptp->max_adj || delta < -ptp->max_adj) return -EINVAL; - _rtl8125_phc_adjfreq(ptp, delta); + _rtl8126_phc_adjfreq(ptp, delta); return 0; } #endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) -static int rtl8125_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts64) +static int rtl8126_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts64) { - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); + struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); int ret; //netif_info(tp, drv, tp->dev, "phc get ts\n"); rtnl_lock(); - ret = _rtl8125_phc_gettime(tp, ts64); + ret = _rtl8126_phc_gettime(tp, ts64); rtnl_unlock(); return ret; } -static int rtl8125_phc_settime(struct ptp_clock_info *ptp, +static int rtl8126_phc_settime(struct ptp_clock_info *ptp, const struct timespec64 *ts64) { - struct rtl8125_private *tp = container_of(ptp, struct rtl8125_private, ptp_clock_info); + struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); int ret; //netif_info(tp, drv, tp->dev, "phc set ts\n"); rtnl_lock(); - ret = _rtl8125_phc_settime(tp, ts64); + ret = _rtl8126_phc_settime(tp, ts64); rtnl_unlock(); return ret; } -static int rtl8125_phc_enable(struct ptp_clock_info *ptp, +static int rtl8126_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); + struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); u16 ptp_ctrl; //netif_info(tp, drv, tp->dev, "phc enable type %x on %d\n", rq->type, on); @@ -268,10 +268,10 @@ static int rtl8125_phc_enable(struct ptp_clock_info *ptp, } } -int rtl8125_get_ts_info(struct net_device *netdev, +int rtl8126_get_ts_info(struct net_device *netdev, struct ethtool_ts_info *info) { - struct rtl8125_private *tp = netdev_priv(netdev); + struct rtl8126_private *tp = netdev_priv(netdev); /* we always support timestamping disabled */ info->rx_filters = BIT(HWTSTAMP_FILTER_NONE); @@ -312,36 +312,36 @@ static const struct ptp_clock_info rtl_ptp_clock_info = { .n_pins = 0, .pps = 1, #if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) - .adjfreq = rtl8125_phc_adjfreq, + .adjfreq = rtl8126_phc_adjfreq, #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, + .adjtime = rtl8126_phc_adjtime, + .gettime64 = rtl8126_phc_gettime, + .settime64 = rtl8126_phc_settime, + .enable = rtl8126_phc_enable, }; -static int rtl8125_ptp_egresstime(struct rtl8125_private *tp, struct timespec64 *ts64, u32 regnum) +static int rtl8126_ptp_egresstime(struct rtl8126_private *tp, struct timespec64 *ts64, u32 regnum) { /* nanoseconds */ //[29:0] - ts64->tv_nsec = rtl8125_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16 + 2); + ts64->tv_nsec = rtl8126_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 |= rtl8126_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 = rtl8126_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 |= rtl8126_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 |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16); ts64->tv_sec &= 0x0000ffffffffffff; return 0; } -static void rtl8125_ptp_tx_hwtstamp(struct rtl8125_private *tp) +static void rtl8126_ptp_tx_hwtstamp(struct rtl8126_private *tp) { struct sk_buff *skb = tp->ptp_tx_skb; struct skb_shared_hwtstamps shhwtstamps = {0}; @@ -356,7 +356,7 @@ static void rtl8125_ptp_tx_hwtstamp(struct rtl8125_private *tp) regnum = (regnum + 3) % 4; rtnl_lock(); - rtl8125_ptp_egresstime(tp, &ts64, regnum); + rtl8126_ptp_egresstime(tp, &ts64, regnum); rtnl_unlock(); /* Upper 32 bits contain s, lower 32 bits contain ns. */ @@ -369,27 +369,27 @@ 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); + clear_bit_unlock(__RTL8126_PTP_TX_IN_PROGRESS, &tp->state); /* Notify the stack and free the skb after we've unlocked */ skb_tstamp_tx(skb, &shhwtstamps); dev_kfree_skb_any(skb); } -#define RTL8125_PTP_TX_TIMEOUT (HZ * 15) -static void rtl8125_ptp_tx_work(struct work_struct *work) +#define RTL8126_PTP_TX_TIMEOUT (HZ * 15) +static void rtl8126_ptp_tx_work(struct work_struct *work) { - struct rtl8125_private *tp = container_of(work, struct rtl8125_private, + struct rtl8126_private *tp = container_of(work, struct rtl8126_private, ptp_tx_work); if (!tp->ptp_tx_skb) return; if (time_is_before_jiffies(tp->ptp_tx_start + - RTL8125_PTP_TX_TIMEOUT)) { + RTL8126_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); + clear_bit_unlock(__RTL8126_PTP_TX_IN_PROGRESS, &tp->state); tp->tx_hwtstamp_timeouts++; /* Clear the tx valid bit in TSYNCTXCTL register to enable * interrupt @@ -399,14 +399,14 @@ static void rtl8125_ptp_tx_work(struct work_struct *work) } if (RTL_R8(tp, PTP_ISR_8125) & (PTP_ISR_TOK)) - rtl8125_ptp_tx_hwtstamp(tp); + rtl8126_ptp_tx_hwtstamp(tp); else /* reschedule to check later */ schedule_work(&tp->ptp_tx_work); } -static int rtl8125_hwtstamp_enable(struct rtl8125_private *tp, bool enable) +static int rtl8126_hwtstamp_enable(struct rtl8126_private *tp, bool enable) { RTL_W16(tp, PTP_CTRL_8125, 0); if (enable) { @@ -416,7 +416,7 @@ static int rtl8125_hwtstamp_enable(struct rtl8125_private *tp, bool enable) //clear ptp isr RTL_W8(tp, PTP_ISR_8125, 0xff); //ptp source 0:gphy 1:mac - rtl8125_mac_ocp_write(tp, 0xDC00, rtl8125_mac_ocp_read(tp, 0xDC00) | BIT_6); + rtl8126_mac_ocp_write(tp, 0xDC00, rtl8126_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) @@ -426,16 +426,16 @@ static int rtl8125_hwtstamp_enable(struct rtl8125_private *tp, bool enable) //set system time /* if (ktime_to_timespec64_cond(ktime_get_real(), &ts64)) - _rtl8125_phc_settime(tp, timespec64_to_timespec(ts64)); + _rtl8126_phc_settime(tp, timespec64_to_timespec(ts64)); */ ktime_get_real_ts64(&ts64); - _rtl8125_phc_settime(tp, &ts64); + _rtl8126_phc_settime(tp, &ts64); } return 0; } -static long rtl8125_ptp_create_clock(struct rtl8125_private *tp) +static long rtl8126_ptp_create_clock(struct rtl8126_private *tp) { struct net_device *netdev = tp->dev; long err; @@ -464,52 +464,52 @@ static long rtl8125_ptp_create_clock(struct rtl8125_private *tp) return 0; } -void rtl8125_ptp_reset(struct rtl8125_private *tp) +void rtl8126_ptp_reset(struct rtl8126_private *tp) { if (!tp->ptp_clock) return; netif_info(tp, drv, tp->dev, "reset PHC clock\n"); - rtl8125_hwtstamp_enable(tp, false); + rtl8126_hwtstamp_enable(tp, false); } -void rtl8125_ptp_init(struct rtl8125_private *tp) +void rtl8126_ptp_init(struct rtl8126_private *tp) { /* obtain a PTP device, or re-use an existing device */ - if (rtl8125_ptp_create_clock(tp)) + if (rtl8126_ptp_create_clock(tp)) return; /* we have a clock so we can initialize work now */ - INIT_WORK(&tp->ptp_tx_work, rtl8125_ptp_tx_work); + INIT_WORK(&tp->ptp_tx_work, rtl8126_ptp_tx_work); /* reset the PTP related hardware bits */ - rtl8125_ptp_reset(tp); + rtl8126_ptp_reset(tp); return; } -void rtl8125_ptp_suspend(struct rtl8125_private *tp) +void rtl8126_ptp_suspend(struct rtl8126_private *tp) { if (!tp->ptp_clock) return; netif_info(tp, drv, tp->dev, "suspend PHC clock\n"); - rtl8125_hwtstamp_enable(tp, false); + rtl8126_hwtstamp_enable(tp, false); /* ensure that we cancel any pending PTP Tx work item in progress */ cancel_work_sync(&tp->ptp_tx_work); } -void rtl8125_ptp_stop(struct rtl8125_private *tp) +void rtl8126_ptp_stop(struct rtl8126_private *tp) { struct net_device *netdev = tp->dev; netif_info(tp, drv, tp->dev, "stop PHC clock\n"); /* first, suspend PTP activity */ - rtl8125_ptp_suspend(tp); + rtl8126_ptp_suspend(tp); /* disable the PTP clock device */ if (tp->ptp_clock) { @@ -520,9 +520,9 @@ void rtl8125_ptp_stop(struct rtl8125_private *tp) } } -static int rtl8125_set_tstamp(struct net_device *netdev, struct ifreq *ifr) +static int rtl8126_set_tstamp(struct net_device *netdev, struct ifreq *ifr) { - struct rtl8125_private *tp = netdev_priv(netdev); + struct rtl8126_private *tp = netdev_priv(netdev); struct hwtstamp_config config; bool hwtstamp = 0; @@ -565,16 +565,16 @@ static int rtl8125_set_tstamp(struct net_device *netdev, struct ifreq *ifr) if (tp->hwtstamp_config.tx_type != config.tx_type || tp->hwtstamp_config.rx_filter != config.rx_filter) { tp->hwtstamp_config = config; - rtl8125_hwtstamp_enable(tp, hwtstamp); + rtl8126_hwtstamp_enable(tp, hwtstamp); } return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ? -EFAULT : 0; } -static int rtl8125_get_tstamp(struct net_device *netdev, struct ifreq *ifr) +static int rtl8126_get_tstamp(struct net_device *netdev, struct ifreq *ifr) { - struct rtl8125_private *tp = netdev_priv(netdev); + struct rtl8126_private *tp = netdev_priv(netdev); //netif_info(tp, drv, tp->dev, "ptp get ts\n"); @@ -582,7 +582,7 @@ static int rtl8125_get_tstamp(struct net_device *netdev, struct ifreq *ifr) sizeof(tp->hwtstamp_config)) ? -EFAULT : 0; } -int rtl8125_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) +int rtl8126_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) { int ret; @@ -591,10 +591,10 @@ int rtl8125_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) switch (cmd) { #ifdef ENABLE_PTP_SUPPORT case SIOCSHWTSTAMP: - ret = rtl8125_set_tstamp(netdev, ifr); + ret = rtl8126_set_tstamp(netdev, ifr); break; case SIOCGHWTSTAMP: - ret = rtl8125_get_tstamp(netdev, ifr); + ret = rtl8126_get_tstamp(netdev, ifr); break; #endif default: @@ -605,7 +605,7 @@ int rtl8125_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) return ret; } -void rtl8125_rx_ptp_pktstamp(struct rtl8125_private *tp, struct sk_buff *skb, +void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb, struct RxDescV3 *descv3) { time64_t tv_sec; diff --git a/r8125_ptp.h b/r8126_ptp.h similarity index 75% rename from r8125_ptp.h rename to r8126_ptp.h index d48dda1..37b72b0 100644 --- a/r8125_ptp.h +++ b/r8126_ptp.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,8 +32,8 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ -#ifndef _LINUX_rtl8125_PTP_H -#define _LINUX_rtl8125_PTP_H +#ifndef _LINUX_R8126_PTP_H +#define _LINUX_R8126_PTP_H #include #include @@ -41,7 +41,7 @@ #include #include -struct rtl8125_ptp_info { +struct rtl8126_ptp_info { s64 time_sec; u32 time_ns; u16 ts_info; @@ -62,20 +62,20 @@ enum PTP_CMD_TYPE { }; -struct rtl8125_private; +struct rtl8126_private; struct RxDescV3; -int rtl8125_get_ts_info(struct net_device *netdev, +int rtl8126_get_ts_info(struct net_device *netdev, struct ethtool_ts_info *info); -void rtl8125_ptp_reset(struct rtl8125_private *tp); -void rtl8125_ptp_init(struct rtl8125_private *tp); -void rtl8125_ptp_suspend(struct rtl8125_private *tp); -void rtl8125_ptp_stop(struct rtl8125_private *tp); +void rtl8126_ptp_reset(struct rtl8126_private *tp); +void rtl8126_ptp_init(struct rtl8126_private *tp); +void rtl8126_ptp_suspend(struct rtl8126_private *tp); +void rtl8126_ptp_stop(struct rtl8126_private *tp); -int rtl8125_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); +int rtl8126_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); -void rtl8125_rx_ptp_pktstamp(struct rtl8125_private *tp, struct sk_buff *skb, +void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb, struct RxDescV3 *descv3); -#endif /* _LINUX_rtl8125_PTP_H */ +#endif /* _LINUX_R8126_PTP_H */ diff --git a/r8125_realwow.h b/r8126_realwow.h similarity index 86% rename from r8125_realwow.h rename to r8126_realwow.h index 2f6b142..8d8998e 100644 --- a/r8125_realwow.h +++ b/r8126_realwow.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,8 +32,8 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ -#ifndef _LINUX_R8125_REALWOW_H -#define _LINUX_R8125_REALWOW_H +#ifndef _LINUX_R8126_REALWOW_H +#define _LINUX_R8126_REALWOW_H #define SIOCDEVPRIVATE_RTLREALWOW SIOCDEVPRIVATE+3 @@ -110,9 +110,9 @@ typedef struct _RealWoWWPInfo { u8 pattern[MAX_RealWoW_Payload]; } RealWoWWPInfo,*PRealWoWWPInfo; -int rtl8125_realwow_ioctl(struct net_device *dev, struct ifreq *ifr); -void rtl8125_realwow_hw_init(struct net_device *dev); -void rtl8125_get_realwow_hw_version(struct net_device *dev); -void rtl8125_set_realwow_d3_para(struct net_device *dev); +int rtl8126_realwow_ioctl(struct net_device *dev, struct ifreq *ifr); +void rtl8126_realwow_hw_init(struct net_device *dev); +void rtl8126_get_realwow_hw_version(struct net_device *dev); +void rtl8126_set_realwow_d3_para(struct net_device *dev); -#endif /* _LINUX_R8125_REALWOW_H */ +#endif /* _LINUX_R8126_REALWOW_H */ diff --git a/r8125_rss.c b/r8126_rss.c similarity index 76% rename from r8125_rss.c rename to r8126_rss.c index 29e462f..666e24e 100644 --- a/r8125_rss.c +++ b/r8126_rss.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -33,9 +33,9 @@ ***********************************************************************************/ #include -#include "r8125.h" +#include "r8126.h" -enum rtl8125_rss_register_content { +enum rtl8126_rss_register_content { /* RSS */ RSS_CTRL_TCP_IPV4_SUPP = (1 << 0), RSS_CTRL_IPV4_SUPP = (1 << 1), @@ -51,7 +51,7 @@ enum rtl8125_rss_register_content { RSS_HQ_Q_SUP_R = (1 << 31), }; -static int rtl8125_get_rss_hash_opts(struct rtl8125_private *tp, +static int rtl8126_get_rss_hash_opts(struct rtl8126_private *tp, struct ethtool_rxnfc *cmd) { cmd->data = 0; @@ -60,21 +60,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; @@ -85,10 +85,10 @@ static int rtl8125_get_rss_hash_opts(struct rtl8125_private *tp, return 0; } -int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, +int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, u32 *rule_locs) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ret = -EOPNOTSUPP; netif_info(tp, drv, tp->dev, "rss get rxnfc\n"); @@ -98,11 +98,11 @@ int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, switch (cmd->cmd) { case ETHTOOL_GRXRINGS: - cmd->data = rtl8125_tot_rx_rings(tp); + cmd->data = rtl8126_tot_rx_rings(tp); ret = 0; break; case ETHTOOL_GRXFH: - ret = rtl8125_get_rss_hash_opts(tp, cmd); + ret = rtl8126_get_rss_hash_opts(tp, cmd); break; default: break; @@ -111,22 +111,22 @@ int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, return ret; } -u32 rtl8125_rss_indir_tbl_entries(struct rtl8125_private *tp) +u32 rtl8126_rss_indir_tbl_entries(struct rtl8126_private *tp) { return tp->HwSuppIndirTblEntries; } #define RSS_MASK_BITS_OFFSET (8) #define RSS_CPU_NUM_OFFSET (16) -#define RTL8125_UDP_RSS_FLAGS (RTL_8125_RSS_FLAG_HASH_UDP_IPV4 | \ +#define RTL8126_UDP_RSS_FLAGS (RTL_8125_RSS_FLAG_HASH_UDP_IPV4 | \ RTL_8125_RSS_FLAG_HASH_UDP_IPV6) -static int _rtl8125_set_rss_hash_opt(struct rtl8125_private *tp) +static int _rtl8126_set_rss_hash_opt(struct rtl8126_private *tp) { u32 rss_flags = tp->rss_flags; u32 hash_mask_len; u32 rss_ctrl; - rss_ctrl = ilog2(rtl8125_tot_rx_rings(tp)); + rss_ctrl = ilog2(rtl8126_tot_rx_rings(tp)); rss_ctrl &= (BIT_0 | BIT_1 | BIT_2); rss_ctrl <<= RSS_CPU_NUM_OFFSET; @@ -145,7 +145,7 @@ static int _rtl8125_set_rss_hash_opt(struct rtl8125_private *tp) rss_ctrl |= RSS_CTRL_UDP_IPV6_SUPP | RSS_CTRL_UDP_IPV6_EXT_SUPP; - hash_mask_len = ilog2(rtl8125_rss_indir_tbl_entries(tp)); + hash_mask_len = ilog2(rtl8126_rss_indir_tbl_entries(tp)); hash_mask_len &= (BIT_0 | BIT_1 | BIT_2); rss_ctrl |= hash_mask_len << RSS_MASK_BITS_OFFSET; @@ -154,7 +154,7 @@ static int _rtl8125_set_rss_hash_opt(struct rtl8125_private *tp) return 0; } -static int rtl8125_set_rss_hash_opt(struct rtl8125_private *tp, +static int rtl8126_set_rss_hash_opt(struct rtl8126_private *tp, struct ethtool_rxnfc *nfc) { u32 rss_flags = tp->rss_flags; @@ -233,8 +233,8 @@ static int rtl8125_set_rss_hash_opt(struct rtl8125_private *tp, if (rss_flags != tp->rss_flags) { u32 rss_ctrl = RTL_R32(tp, RSS_CTRL_8125); - if ((rss_flags & RTL8125_UDP_RSS_FLAGS) && - !(tp->rss_flags & RTL8125_UDP_RSS_FLAGS)) + if ((rss_flags & RTL8126_UDP_RSS_FLAGS) && + !(tp->rss_flags & RTL8126_UDP_RSS_FLAGS)) netdev_warn(tp->dev, "enabling UDP RSS: fragmented packets may " "arrive out of order to the stack above\n"); @@ -266,9 +266,9 @@ static int rtl8125_set_rss_hash_opt(struct rtl8125_private *tp, return 0; } -int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) +int rtl8126_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int ret = -EOPNOTSUPP; netif_info(tp, drv, tp->dev, "rss set rxnfc\n"); @@ -278,7 +278,7 @@ int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) switch (cmd->cmd) { case ETHTOOL_SRXFH: - ret = rtl8125_set_rss_hash_opt(tp, cmd); + ret = rtl8126_set_rss_hash_opt(tp, cmd); break; default: break; @@ -287,47 +287,47 @@ int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) return ret; } -static u32 _rtl8125_get_rxfh_key_size(struct rtl8125_private *tp) +static u32 _rtl8126_get_rxfh_key_size(struct rtl8126_private *tp) { return sizeof(tp->rss_key); } -u32 rtl8125_get_rxfh_key_size(struct net_device *dev) +u32 rtl8126_get_rxfh_key_size(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); netif_info(tp, drv, tp->dev, "rss get key size\n"); if (!(dev->features & NETIF_F_RXHASH)) return 0; - return _rtl8125_get_rxfh_key_size(tp); + return _rtl8126_get_rxfh_key_size(tp); } -u32 rtl8125_rss_indir_size(struct net_device *dev) +u32 rtl8126_rss_indir_size(struct net_device *dev) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); netif_info(tp, drv, tp->dev, "rss get indir tbl size\n"); if (!(dev->features & NETIF_F_RXHASH)) return 0; - return rtl8125_rss_indir_tbl_entries(tp); + return rtl8126_rss_indir_tbl_entries(tp); } -static void rtl8125_get_reta(struct rtl8125_private *tp, u32 *indir) +static void rtl8126_get_reta(struct rtl8126_private *tp, u32 *indir) { - int i, reta_size = rtl8125_rss_indir_tbl_entries(tp); + int i, reta_size = rtl8126_rss_indir_tbl_entries(tp); for (i = 0; i < reta_size; i++) indir[i] = tp->rss_indir_tbl[i]; } -int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, +int rtl8126_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, u8 *hfunc) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); netif_info(tp, drv, tp->dev, "rss get rxfh\n"); @@ -338,28 +338,28 @@ int rtl8125_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, *hfunc = ETH_RSS_HASH_TOP; if (indir) - rtl8125_get_reta(tp, indir); + rtl8126_get_reta(tp, indir); if (key) - memcpy(key, tp->rss_key, RTL8125_RSS_KEY_SIZE); + memcpy(key, tp->rss_key, RTL8126_RSS_KEY_SIZE); return 0; } -static u32 rtl8125_rss_key_reg(struct rtl8125_private *tp) +static u32 rtl8126_rss_key_reg(struct rtl8126_private *tp) { return RSS_KEY_8125; } -static u32 rtl8125_rss_indir_tbl_reg(struct rtl8125_private *tp) +static u32 rtl8126_rss_indir_tbl_reg(struct rtl8126_private *tp) { return RSS_INDIRECTION_TBL_8125_V2; } -static void rtl8125_store_reta(struct rtl8125_private *tp) +static void rtl8126_store_reta(struct rtl8126_private *tp) { - u16 indir_tbl_reg = rtl8125_rss_indir_tbl_reg(tp); - u32 i, reta_entries = rtl8125_rss_indir_tbl_entries(tp); + u16 indir_tbl_reg = rtl8126_rss_indir_tbl_reg(tp); + u32 i, reta_entries = rtl8126_rss_indir_tbl_entries(tp); u32 reta = 0; u8 *indir_tbl = tp->rss_indir_tbl; @@ -375,10 +375,10 @@ static void rtl8125_store_reta(struct rtl8125_private *tp) } } -static void rtl8125_store_rss_key(struct rtl8125_private *tp) +static void rtl8126_store_rss_key(struct rtl8126_private *tp) { - const u16 rss_key_reg = rtl8125_rss_key_reg(tp); - u32 i, rss_key_size = _rtl8125_get_rxfh_key_size(tp); + const u16 rss_key_reg = rtl8126_rss_key_reg(tp); + u32 i, rss_key_size = _rtl8126_get_rxfh_key_size(tp); u32 *rss_key = (u32*)tp->rss_key; /* Write redirection table to HW */ @@ -386,12 +386,12 @@ static void rtl8125_store_rss_key(struct rtl8125_private *tp) RTL_W32(tp, rss_key_reg + i, *rss_key++); } -int rtl8125_set_rxfh(struct net_device *dev, const u32 *indir, +int rtl8126_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key, const u8 hfunc) { - struct rtl8125_private *tp = netdev_priv(dev); + struct rtl8126_private *tp = netdev_priv(dev); int i; - u32 reta_entries = rtl8125_rss_indir_tbl_entries(tp); + u32 reta_entries = rtl8126_rss_indir_tbl_entries(tp); netif_info(tp, drv, tp->dev, "rss set rxfh\n"); @@ -416,16 +416,16 @@ 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, RTL8126_RSS_KEY_SIZE); - rtl8125_store_reta(tp); + rtl8126_store_reta(tp); - rtl8125_store_rss_key(tp); + rtl8126_store_rss_key(tp); return 0; } -static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp, +static u32 rtl8126_get_rx_desc_hash(struct rtl8126_private *tp, struct RxDescV3 *descv3) { return le32_to_cpu(descv3->RxDescNormalDDWord2.RSSResult); @@ -435,9 +435,9 @@ static u32 rtl8125_get_rx_desc_hash(struct rtl8125_private *tp, #define RXS_8125_RSS_IPV4 BIT(10) #define RXS_8125_RSS_IPV6 BIT(12) #define RXS_8125_RSS_TCP BIT(13) -#define RTL8125_RXS_RSS_L3_TYPE_MASK (RXS_8125_RSS_IPV4 | RXS_8125_RSS_IPV6) -#define RTL8125_RXS_RSS_L4_TYPE_MASK (RXS_8125_RSS_TCP | RXS_8125B_RSS_UDP) -void rtl8125_rx_hash(struct rtl8125_private *tp, +#define RTL8126_RXS_RSS_L3_TYPE_MASK (RXS_8125_RSS_IPV4 | RXS_8125_RSS_IPV6) +#define RTL8126_RXS_RSS_L4_TYPE_MASK (RXS_8125_RSS_TCP | RXS_8125B_RSS_UDP) +void rtl8126_rx_hash(struct rtl8126_private *tp, struct RxDescV3 *descv3, struct sk_buff *skb) { @@ -448,44 +448,44 @@ void rtl8125_rx_hash(struct rtl8125_private *tp, rss_header_info = le16_to_cpu(descv3->RxDescNormalDDWord2.HeaderInfo); - if (!(rss_header_info & RTL8125_RXS_RSS_L3_TYPE_MASK)) + if (!(rss_header_info & RTL8126_RXS_RSS_L3_TYPE_MASK)) return; - skb_set_hash(skb, rtl8125_get_rx_desc_hash(tp, descv3), - (RTL8125_RXS_RSS_L4_TYPE_MASK & rss_header_info) ? + skb_set_hash(skb, rtl8126_get_rx_desc_hash(tp, descv3), + (RTL8126_RXS_RSS_L4_TYPE_MASK & rss_header_info) ? PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); } -void rtl8125_disable_rss(struct rtl8125_private *tp) +void rtl8126_disable_rss(struct rtl8126_private *tp) { RTL_W32(tp, RSS_CTRL_8125, 0x00); } -void _rtl8125_config_rss(struct rtl8125_private *tp) +void _rtl8126_config_rss(struct rtl8126_private *tp) { - _rtl8125_set_rss_hash_opt(tp); + _rtl8126_set_rss_hash_opt(tp); - rtl8125_store_reta(tp); + rtl8126_store_reta(tp); - rtl8125_store_rss_key(tp); + rtl8126_store_rss_key(tp); } -void rtl8125_config_rss(struct rtl8125_private *tp) +void rtl8126_config_rss(struct rtl8126_private *tp) { if (!tp->EnableRss) { - rtl8125_disable_rss(tp); + rtl8126_disable_rss(tp); return; } - _rtl8125_config_rss(tp); + _rtl8126_config_rss(tp); } -void rtl8125_init_rss(struct rtl8125_private *tp) +void rtl8126_init_rss(struct rtl8126_private *tp) { int i; - for (i = 0; i < rtl8125_rss_indir_tbl_entries(tp); i++) + for (i = 0; i < rtl8126_rss_indir_tbl_entries(tp); i++) tp->rss_indir_tbl[i] = ethtool_rxfh_indir_default(i, tp->num_rx_rings); - netdev_rss_key_fill(tp->rss_key, RTL8125_RSS_KEY_SIZE); + netdev_rss_key_fill(tp->rss_key, RTL8126_RSS_KEY_SIZE); } diff --git a/r8125_rss.h b/r8126_rss.h similarity index 61% rename from r8125_rss.h rename to r8126_rss.h index d893b49..0d6062d 100644 --- a/r8125_rss.h +++ b/r8126_rss.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,38 +32,38 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ -#ifndef _LINUX_rtl8125_RSS_H -#define _LINUX_rtl8125_RSS_H +#ifndef _LINUX_R8126_RSS_H +#define _LINUX_R8126_RSS_H #include #include -#define RTL8125_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ -#define RTL8125_MAX_INDIRECTION_TABLE_ENTRIES 128 +#define RTL8126_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ +#define RTL8126_MAX_INDIRECTION_TABLE_ENTRIES 128 -enum rtl8125_rss_flag { +enum rtl8126_rss_flag { RTL_8125_RSS_FLAG_HASH_UDP_IPV4 = (1 << 0), RTL_8125_RSS_FLAG_HASH_UDP_IPV6 = (1 << 1), }; -struct rtl8125_private; +struct rtl8126_private; -int rtl8125_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, +int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, u32 *rule_locs); -int rtl8125_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); -u32 rtl8125_get_rxfh_key_size(struct net_device *netdev); -u32 rtl8125_rss_indir_size(struct net_device *netdev); -int rtl8125_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, +int rtl8126_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); +u32 rtl8126_get_rxfh_key_size(struct net_device *netdev); +u32 rtl8126_rss_indir_size(struct net_device *netdev); +int rtl8126_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc); -int rtl8125_set_rxfh(struct net_device *netdev, const u32 *indir, +int rtl8126_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, const u8 hfunc); -void rtl8125_rx_hash(struct rtl8125_private *tp, +void rtl8126_rx_hash(struct rtl8126_private *tp, struct RxDescV3 *descv3, struct sk_buff *skb); -void _rtl8125_config_rss(struct rtl8125_private *tp); -void rtl8125_config_rss(struct rtl8125_private *tp); -void rtl8125_init_rss(struct rtl8125_private *tp); -u32 rtl8125_rss_indir_tbl_entries(struct rtl8125_private *tp); -void rtl8125_disable_rss(struct rtl8125_private *tp); +void _rtl8126_config_rss(struct rtl8126_private *tp); +void rtl8126_config_rss(struct rtl8126_private *tp); +void rtl8126_init_rss(struct rtl8126_private *tp); +u32 rtl8126_rss_indir_tbl_entries(struct rtl8126_private *tp); +void rtl8126_disable_rss(struct rtl8126_private *tp); -#endif /* _LINUX_rtl8125_RSS_H */ +#endif /* _LINUX_R8126_RSS_H */ diff --git a/rtl_eeprom.c b/rtl_eeprom.c index 71fe0db..6421df4 100644 --- a/rtl_eeprom.c +++ b/rtl_eeprom.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -41,17 +41,17 @@ #include -#include "r8125.h" +#include "r8126.h" #include "rtl_eeprom.h" //------------------------------------------------------------------- -//rtl8125_eeprom_type(): +//rtl8126_eeprom_type(): // tell the eeprom type //return value: // 0: the eeprom type is 93C46 // 1: the eeprom type is 93C56 or 93C66 //------------------------------------------------------------------- -void rtl8125_eeprom_type(struct rtl8125_private *tp) +void rtl8126_eeprom_type(struct rtl8126_private *tp) { u16 magic = 0; @@ -71,7 +71,7 @@ void rtl8125_eeprom_type(struct rtl8125_private *tp) tp->eeprom_len = 128; } - magic = rtl8125_eeprom_read_sc(tp, 0); + magic = rtl8126_eeprom_read_sc(tp, 0); out_no_eeprom: if ((magic != 0x8129) && (magic != 0x8128)) { @@ -80,7 +80,7 @@ out_no_eeprom: } } -void rtl8125_eeprom_cleanup(struct rtl8125_private *tp) +void rtl8126_eeprom_cleanup(struct rtl8126_private *tp) { u8 x; @@ -89,16 +89,16 @@ void rtl8125_eeprom_cleanup(struct rtl8125_private *tp) RTL_W8(tp, Cfg9346, x); - rtl8125_raise_clock(tp, &x); - rtl8125_lower_clock(tp, &x); + rtl8126_raise_clock(tp, &x); + rtl8126_lower_clock(tp, &x); } -int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp) +int rtl8126_eeprom_cmd_done(struct rtl8126_private *tp) { u8 x; int i; - rtl8125_stand_by(tp); + rtl8126_stand_by(tp); for (i = 0; i < 50000; i++) { x = RTL_R8(tp, Cfg9346); @@ -114,10 +114,10 @@ int rtl8125_eeprom_cmd_done(struct rtl8125_private *tp) } //------------------------------------------------------------------- -//rtl8125_eeprom_read_sc(): +//rtl8126_eeprom_read_sc(): // read one word from eeprom //------------------------------------------------------------------- -u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg) +u16 rtl8126_eeprom_read_sc(struct rtl8126_private *tp, u16 reg) { int addr_sz = 6; u8 x; @@ -135,12 +135,12 @@ u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg) x = Cfg9346_EEM1 | Cfg9346_EECS; RTL_W8(tp, Cfg9346, x); - rtl8125_shift_out_bits(tp, RTL_EEPROM_READ_OPCODE, 3); - rtl8125_shift_out_bits(tp, reg, addr_sz); + rtl8126_shift_out_bits(tp, RTL_EEPROM_READ_OPCODE, 3); + rtl8126_shift_out_bits(tp, reg, addr_sz); - data = rtl8125_shift_in_bits(tp); + data = rtl8126_shift_in_bits(tp); - rtl8125_eeprom_cleanup(tp); + rtl8126_eeprom_cleanup(tp); RTL_W8(tp, Cfg9346, 0); @@ -148,10 +148,10 @@ u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg) } //------------------------------------------------------------------- -//rtl8125_eeprom_write_sc(): +//rtl8126_eeprom_write_sc(): // write one word to a specific address in the eeprom //------------------------------------------------------------------- -void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data) +void rtl8126_eeprom_write_sc(struct rtl8126_private *tp, u16 reg, u16 data) { u8 x; int addr_sz = 6; @@ -172,40 +172,40 @@ void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data) x = Cfg9346_EEM1 | Cfg9346_EECS; RTL_W8(tp, Cfg9346, x); - rtl8125_shift_out_bits(tp, RTL_EEPROM_EWEN_OPCODE, 5); - rtl8125_shift_out_bits(tp, reg, w_dummy_addr); - rtl8125_stand_by(tp); + rtl8126_shift_out_bits(tp, RTL_EEPROM_EWEN_OPCODE, 5); + rtl8126_shift_out_bits(tp, reg, w_dummy_addr); + rtl8126_stand_by(tp); - rtl8125_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3); - rtl8125_shift_out_bits(tp, reg, addr_sz); - if (rtl8125_eeprom_cmd_done(tp) < 0) { + rtl8126_shift_out_bits(tp, RTL_EEPROM_ERASE_OPCODE, 3); + rtl8126_shift_out_bits(tp, reg, addr_sz); + if (rtl8126_eeprom_cmd_done(tp) < 0) { return; } - rtl8125_stand_by(tp); + rtl8126_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) { + rtl8126_shift_out_bits(tp, RTL_EEPROM_WRITE_OPCODE, 3); + rtl8126_shift_out_bits(tp, reg, addr_sz); + rtl8126_shift_out_bits(tp, data, 16); + if (rtl8126_eeprom_cmd_done(tp) < 0) { return; } - rtl8125_stand_by(tp); + rtl8126_stand_by(tp); - rtl8125_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); - rtl8125_shift_out_bits(tp, reg, w_dummy_addr); + rtl8126_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); + rtl8126_shift_out_bits(tp, reg, w_dummy_addr); - rtl8125_eeprom_cleanup(tp); + rtl8126_eeprom_cleanup(tp); RTL_W8(tp, Cfg9346, 0); } -void rtl8125_raise_clock(struct rtl8125_private *tp, u8 *x) +void rtl8126_raise_clock(struct rtl8126_private *tp, u8 *x) { *x = *x | Cfg9346_EESK; RTL_W8(tp, Cfg9346, *x); udelay(RTL_CLOCK_RATE); } -void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x) +void rtl8126_lower_clock(struct rtl8126_private *tp, u8 *x) { *x = *x & ~Cfg9346_EESK; @@ -213,7 +213,7 @@ void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x) udelay(RTL_CLOCK_RATE); } -void rtl8125_shift_out_bits(struct rtl8125_private *tp, int data, int count) +void rtl8126_shift_out_bits(struct rtl8126_private *tp, int data, int count) { u8 x; int mask; @@ -230,8 +230,8 @@ void rtl8125_shift_out_bits(struct rtl8125_private *tp, int data, int count) RTL_W8(tp, Cfg9346, x); udelay(RTL_CLOCK_RATE); - rtl8125_raise_clock(tp, &x); - rtl8125_lower_clock(tp, &x); + rtl8126_raise_clock(tp, &x); + rtl8126_lower_clock(tp, &x); mask = mask >> 1; } while(mask); @@ -239,7 +239,7 @@ void rtl8125_shift_out_bits(struct rtl8125_private *tp, int data, int count) RTL_W8(tp, Cfg9346, x); } -u16 rtl8125_shift_in_bits(struct rtl8125_private *tp) +u16 rtl8126_shift_in_bits(struct rtl8126_private *tp) { u8 x; u16 d, i; @@ -251,7 +251,7 @@ u16 rtl8125_shift_in_bits(struct rtl8125_private *tp) for (i = 0; i < 16; i++) { d = d << 1; - rtl8125_raise_clock(tp, &x); + rtl8126_raise_clock(tp, &x); x = RTL_R8(tp, Cfg9346); x &= ~Cfg9346_EEDI; @@ -259,13 +259,13 @@ u16 rtl8125_shift_in_bits(struct rtl8125_private *tp) if (x & Cfg9346_EEDO) d |= 1; - rtl8125_lower_clock(tp, &x); + rtl8126_lower_clock(tp, &x); } return d; } -void rtl8125_stand_by(struct rtl8125_private *tp) +void rtl8126_stand_by(struct rtl8126_private *tp) { u8 x; @@ -278,7 +278,7 @@ void rtl8125_stand_by(struct rtl8125_private *tp) RTL_W8(tp, Cfg9346, x); } -void rtl8125_set_eeprom_sel_low(struct rtl8125_private *tp) +void rtl8126_set_eeprom_sel_low(struct rtl8126_private *tp) { RTL_W8(tp, Cfg9346, Cfg9346_EEM1); RTL_W8(tp, Cfg9346, Cfg9346_EEM1 | Cfg9346_EESK); diff --git a/rtl_eeprom.h b/rtl_eeprom.h index de12095..1e4b568 100644 --- a/rtl_eeprom.h +++ b/rtl_eeprom.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -32,6 +32,9 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ +#ifndef _LINUX_RTLEEPROM_H +#define _LINUX_RTLEEPROM_H + //EEPROM opcodes #define RTL_EEPROM_READ_OPCODE 06 #define RTL_EEPROM_WRITE_OPCODE 05 @@ -41,13 +44,15 @@ #define RTL_CLOCK_RATE 3 -void rtl8125_eeprom_type(struct rtl8125_private *tp); -void rtl8125_eeprom_cleanup(struct rtl8125_private *tp); -u16 rtl8125_eeprom_read_sc(struct rtl8125_private *tp, u16 reg); -void rtl8125_eeprom_write_sc(struct rtl8125_private *tp, u16 reg, u16 data); -void rtl8125_shift_out_bits(struct rtl8125_private *tp, int data, int count); -u16 rtl8125_shift_in_bits(struct rtl8125_private *tp); -void rtl8125_raise_clock(struct rtl8125_private *tp, u8 *x); -void rtl8125_lower_clock(struct rtl8125_private *tp, u8 *x); -void rtl8125_stand_by(struct rtl8125_private *tp); -void rtl8125_set_eeprom_sel_low(struct rtl8125_private *tp); +void rtl8126_eeprom_type(struct rtl8126_private *tp); +void rtl8126_eeprom_cleanup(struct rtl8126_private *tp); +u16 rtl8126_eeprom_read_sc(struct rtl8126_private *tp, u16 reg); +void rtl8126_eeprom_write_sc(struct rtl8126_private *tp, u16 reg, u16 data); +void rtl8126_shift_out_bits(struct rtl8126_private *tp, int data, int count); +u16 rtl8126_shift_in_bits(struct rtl8126_private *tp); +void rtl8126_raise_clock(struct rtl8126_private *tp, u8 *x); +void rtl8126_lower_clock(struct rtl8126_private *tp, u8 *x); +void rtl8126_stand_by(struct rtl8126_private *tp); +void rtl8126_set_eeprom_sel_low(struct rtl8126_private *tp); + +#endif /* _LINUX_RTLEEPROM_H */ diff --git a/rtltool.c b/rtltool.c index 0bba0f7..c4b7d52 100644 --- a/rtltool.c +++ b/rtltool.c @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -40,11 +40,11 @@ #include #include #include -#include "r8125.h" +#include "r8126.h" #include "rtl_eeprom.h" #include "rtltool.h" -int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) +int rtl8126_tool_ioctl(struct rtl8126_private *tp, struct ifreq *ifr) { struct rtltool_cmd my_cmd; int ret; @@ -87,7 +87,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) break; case RTLTOOL_READ_PHY: - my_cmd.data = rtl8125_mdio_prot_read(tp, my_cmd.offset); + my_cmd.data = rtl8126_mdio_prot_read(tp, my_cmd.offset); if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -96,11 +96,11 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) break; case RTLTOOL_WRITE_PHY: - rtl8125_mdio_prot_write(tp, my_cmd.offset, my_cmd.data); + rtl8126_mdio_prot_write(tp, my_cmd.offset, my_cmd.data); break; case RTLTOOL_READ_EPHY: - my_cmd.data = rtl8125_ephy_read(tp, my_cmd.offset); + my_cmd.data = rtl8126_ephy_read(tp, my_cmd.offset); if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -109,13 +109,13 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) break; case RTLTOOL_WRITE_EPHY: - rtl8125_ephy_write(tp, my_cmd.offset, my_cmd.data); + rtl8126_ephy_write(tp, my_cmd.offset, my_cmd.data); break; case RTLTOOL_READ_ERI: my_cmd.data = 0; if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) { - my_cmd.data = rtl8125_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC); + my_cmd.data = rtl8126_eri_read(tp, my_cmd.offset, my_cmd.len, ERIAR_ExGMAC); } else { ret = -EOPNOTSUPP; break; @@ -130,7 +130,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) case RTLTOOL_WRITE_ERI: if (my_cmd.len==1 || my_cmd.len==2 || my_cmd.len==4) { - rtl8125_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC); + rtl8126_eri_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data, ERIAR_ExGMAC); } else { ret = -EOPNOTSUPP; break; @@ -177,7 +177,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) break; case RTLTOOL_READ_EEPROM: - my_cmd.data = rtl8125_eeprom_read_sc(tp, my_cmd.offset); + my_cmd.data = rtl8126_eeprom_read_sc(tp, my_cmd.offset); if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -186,13 +186,13 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) break; case RTLTOOL_WRITE_EEPROM: - rtl8125_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data); + rtl8126_eeprom_write_sc(tp, my_cmd.offset, my_cmd.data); break; case RTL_READ_OOB_MAC: - rtl8125_oob_mutex_lock(tp); - my_cmd.data = rtl8125_ocp_read(tp, my_cmd.offset, 4); - rtl8125_oob_mutex_unlock(tp); + rtl8126_oob_mutex_lock(tp); + my_cmd.data = rtl8126_ocp_read(tp, my_cmd.offset, 4); + rtl8126_oob_mutex_unlock(tp); if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -203,9 +203,9 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (my_cmd.len == 0 || my_cmd.len > 4) return -EOPNOTSUPP; - rtl8125_oob_mutex_lock(tp); - rtl8125_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data); - rtl8125_oob_mutex_unlock(tp); + rtl8126_oob_mutex_lock(tp); + rtl8126_ocp_write(tp, my_cmd.offset, my_cmd.len, my_cmd.data); + rtl8126_oob_mutex_unlock(tp); break; case RTL_ENABLE_PCI_DIAG: @@ -224,7 +224,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if (my_cmd.offset % 2) return -EOPNOTSUPP; - my_cmd.data = rtl8125_mac_ocp_read(tp, my_cmd.offset); + my_cmd.data = rtl8126_mac_ocp_read(tp, my_cmd.offset); if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -235,11 +235,11 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) if ((my_cmd.offset % 2) || (my_cmd.len != 2)) return -EOPNOTSUPP; - rtl8125_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data); + rtl8126_mac_ocp_write(tp, my_cmd.offset, (u16)my_cmd.data); break; case RTL_DIRECT_READ_PHY_OCP: - my_cmd.data = rtl8125_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset); + my_cmd.data = rtl8126_mdio_prot_direct_read_phy_ocp(tp, my_cmd.offset); if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { ret = -EFAULT; break; @@ -248,7 +248,7 @@ int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr) break; case RTL_DIRECT_WRITE_PHY_OCP: - rtl8125_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data); + rtl8126_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data); break; default: diff --git a/rtltool.h b/rtltool.h index c8b319c..1ae1b21 100644 --- a/rtltool.h +++ b/rtltool.h @@ -2,10 +2,10 @@ /* ################################################################################ # -# r8125 is the Linux device driver released for Realtek 2.5/5 Gigabit Ethernet +# r8126 is the Linux device driver released for Realtek 5 Gigabit Ethernet # controllers with PCI-Express interface. # -# Copyright(c) 2023 Realtek Semiconductor Corp. All rights reserved. +# 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 @@ -80,7 +80,7 @@ enum mode_access { }; #ifdef __KERNEL__ -int rtl8125_tool_ioctl(struct rtl8125_private *tp, struct ifreq *ifr); +int rtl8126_tool_ioctl(struct rtl8126_private *tp, struct ifreq *ifr); #endif #endif /* _LINUX_RTLTOOL_H */