From a77d4e6807a5fb19652325be6168c093847bce9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Tue, 5 Nov 2024 00:19:29 +0100 Subject: [PATCH] Update to v10.014.01 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Fernández Rojas --- Makefile | 7 +- r8126.h | 304 +++++++- r8126_dash.h | 8 +- r8126_n.c | 1915 +++++++++++++++++++++++++++++++++++--------------- r8126_ptp.c | 613 ++++++++++++---- r8126_ptp.h | 125 +++- r8126_rss.c | 172 +++-- r8126_rss.h | 9 +- rtl_eeprom.c | 16 +- rtltool.c | 25 + rtltool.h | 3 + 11 files changed, 2395 insertions(+), 802 deletions(-) diff --git a/Makefile b/Makefile index 3e75c19..13ca2df 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ ################################################################################ CONFIG_SOC_LAN = n +ENABLE_FIBER_SUPPORT = n ENABLE_REALWOW_SUPPORT = n ENABLE_DASH_SUPPORT = n ENABLE_DASH_PRINTER_SUPPORT = n @@ -41,7 +42,7 @@ ENABLE_S5_KEEP_CURR_MAC = n ENABLE_EEE = y ENABLE_S0_MAGIC_PACKET = n ENABLE_TX_NO_CLOSE = y -ENABLE_MULTIPLE_TX_QUEUE = y +ENABLE_MULTIPLE_TX_QUEUE = n ENABLE_PTP_SUPPORT = n ENABLE_PTP_MASTER_MODE = n ENABLE_RSS_SUPPORT = n @@ -59,6 +60,10 @@ ifneq ($(KERNELRELEASE),) ifeq ($(CONFIG_SOC_LAN), y) EXTRA_CFLAGS += -DCONFIG_SOC_LAN endif + ifeq ($(ENABLE_FIBER_SUPPORT), y) + r8126-objs += r8126_fiber.o + EXTRA_CFLAGS += -DENABLE_FIBER_SUPPORT + endif ifeq ($(ENABLE_REALWOW_SUPPORT), y) r8126-objs += r8126_realwow.o EXTRA_CFLAGS += -DENABLE_REALWOW_SUPPORT diff --git a/r8126.h b/r8126.h index 9c66f24..ec1a7e8 100644 --- a/r8126.h +++ b/r8126.h @@ -41,7 +41,12 @@ #include #include "r8126_dash.h" #include "r8126_realwow.h" +#ifdef ENABLE_FIBER_SUPPORT +#include "r8126_fiber.h" +#endif /* ENABLE_FIBER_SUPPORT */ +#ifdef ENABLE_PTP_SUPPORT #include "r8126_ptp.h" +#endif #include "r8126_rss.h" #ifdef ENABLE_LIB_SUPPORT #include "r8126_lib.h" @@ -51,6 +56,103 @@ #define fallthrough #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +#define netif_xmit_stopped netif_tx_queue_stopped +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) +#ifndef MDIO_AN_EEE_ADV_100TX +#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */ +#endif +#ifndef MDIO_AN_EEE_ADV_1000T +#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */ +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) +#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */ +#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */ +#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */ +#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */ +#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */ +#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */ +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ + +static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv) +{ + u32 adv = 0; + + if (eee_adv & MDIO_EEE_100TX) + adv |= ADVERTISED_100baseT_Full; + if (eee_adv & MDIO_EEE_1000T) + adv |= ADVERTISED_1000baseT_Full; + if (eee_adv & MDIO_EEE_10GT) + adv |= ADVERTISED_10000baseT_Full; + if (eee_adv & MDIO_EEE_1000KX) + adv |= ADVERTISED_1000baseKX_Full; + if (eee_adv & MDIO_EEE_10GKX4) + adv |= ADVERTISED_10000baseKX4_Full; + if (eee_adv & MDIO_EEE_10GKR) + adv |= ADVERTISED_10000baseKR_Full; + + return adv; +} + +static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv) +{ + u16 reg = 0; + + if (adv & ADVERTISED_100baseT_Full) + reg |= MDIO_EEE_100TX; + if (adv & ADVERTISED_1000baseT_Full) + reg |= MDIO_EEE_1000T; + if (adv & ADVERTISED_10000baseT_Full) + reg |= MDIO_EEE_10GT; + if (adv & ADVERTISED_1000baseKX_Full) + reg |= MDIO_EEE_1000KX; + if (adv & ADVERTISED_10000baseKX4_Full) + reg |= MDIO_EEE_10GKX4; + if (adv & ADVERTISED_10000baseKR_Full) + reg |= MDIO_EEE_10GKR; + + return reg; +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) +static inline bool skb_transport_header_was_set(const struct sk_buff *skb) +{ + return skb->transport_header != ~0U; +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) +static inline void linkmode_set_bit(int nr, volatile unsigned long *addr) +{ + __set_bit(nr, addr); +} + +static inline void linkmode_clear_bit(int nr, volatile unsigned long *addr) +{ + __clear_bit(nr, addr); +} + +static inline int linkmode_test_bit(int nr, volatile unsigned long *addr) +{ + return test_bit(nr, addr); +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) +static inline void linkmode_mod_bit(int nr, volatile unsigned long *addr, + int set) +{ + if (set) + linkmode_set_bit(nr, addr); + else + linkmode_clear_bit(nr, addr); +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) static inline ssize_t strscpy(char *dest, const char *src, size_t count) @@ -110,11 +212,25 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q) {} #define netif_testing_off(dev) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#define netdev_sw_irq_coalesce_default_on(dev) +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) typedef int netdev_tx_t; #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,9) +static inline bool page_is_pfmemalloc(struct page *page) +{ + /* + * Page index cannot be this large so this must be + * a pfmemalloc page. + */ + return page->index == -1UL; +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,9) */ static inline bool dev_page_is_reusable(struct page *page) { return likely(page_to_nid(page) == numa_mem_id() && @@ -273,7 +389,7 @@ do { \ #define ENABLE_R8126_PROCFS #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) #define ENABLE_R8126_SYSFS #endif @@ -392,6 +508,23 @@ do { \ #define MDIO_EEE_5GT 0x0002 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) +#define ethtool_keee ethtool_eee +#define rtl8126_ethtool_adv_to_mmd_eee_adv_cap1_t ethtool_adv_to_mmd_eee_adv_t +static inline u32 rtl8126_ethtool_adv_to_mmd_eee_adv_cap2_t(u32 adv) +{ + u32 result = 0; + + if (adv & SUPPORTED_2500baseX_Full) + result |= MDIO_EEE_2_5GT; + + return result; +} +#else +#define rtl8126_ethtool_adv_to_mmd_eee_adv_cap1_t linkmode_to_mii_eee_cap1_t +#define rtl8126_ethtool_adv_to_mmd_eee_adv_cap2_t linkmode_to_mii_eee_cap2_t +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) #ifdef CONFIG_NET_POLL_CONTROLLER #define RTL_NET_POLL_CONTROLLER dev->poll_controller=rtl8126_netpoll @@ -450,6 +583,16 @@ do { \ #else #define NAPI_SUFFIX "" #endif +#ifdef ENABLE_FIBER_SUPPORT +#define FIBER_SUFFIX "-FIBER" +#else +#define FIBER_SUFFIX "" +#endif +#ifdef ENABLE_REALWOW_SUPPORT +#define REALWOW_SUFFIX "-REALWOW" +#else +#define REALWOW_SUFFIX "" +#endif #if defined(ENABLE_DASH_PRINTER_SUPPORT) #define DASH_SUFFIX "-PRINTER" #elif defined(ENABLE_DASH_SUPPORT) @@ -476,7 +619,7 @@ do { \ #define RSS_SUFFIX "" #endif -#define RTL8126_VERSION "10.013.00" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX +#define RTL8126_VERSION "10.014.01" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX #define MODULENAME "r8126" #define PFX MODULENAME ": " @@ -488,7 +631,7 @@ This is free software, and you are welcome to redistribute it under certain cond #ifdef RTL8126_DEBUG #define assert(expr) \ if(!(expr)) { \ - printk( "Assertion failed! %s,%s,%s,line=%d\n", \ + printk("Assertion failed! %s,%s,%s,line=%d\n", \ #expr,__FILE__,__FUNCTION__,__LINE__); \ } #define dprintk(fmt, args...) do { printk(PFX fmt, ## args); } while (0) @@ -597,7 +740,9 @@ This is free software, and you are welcome to redistribute it under certain cond #endif #define R8126_MAX_TX_QUEUES (2) -#define R8126_MAX_RX_QUEUES (4) +#define R8126_MAX_RX_QUEUES_V2 (4) +#define R8126_MAX_RX_QUEUES_V3 (16) +#define R8126_MAX_RX_QUEUES R8126_MAX_RX_QUEUES_V3 #define R8126_MAX_QUEUES R8126_MAX_RX_QUEUES #define OCP_STD_PHY_BASE 0xa400 @@ -675,10 +820,15 @@ This is free software, and you are welcome to redistribute it under certain cond #define ADVERTISE_1000HALF 0x100 #endif +#ifndef BIT_ULL +#define BIT_ULL(nr) (1ULL << (nr)) +#endif + #ifndef ADVERTISED_2500baseX_Full #define ADVERTISED_2500baseX_Full 0x8000 #endif -#define RTK_ADVERTISED_5000baseX_Full BIT(48) +#define RTK_ADVERTISED_5000baseX_Full BIT_ULL(48) +#define RTK_SUPPORTED_5000baseX_Full BIT_ULL(48) #define RTK_ADVERTISE_2500FULL 0x80 #define RTK_ADVERTISE_5000FULL 0x100 @@ -723,12 +873,16 @@ This is free software, and you are welcome to redistribute it under certain cond #define SPEED_5000 5000 #endif +#define R8126_LINK_STATE_OFF 0 +#define R8126_LINK_STATE_ON 1 +#define R8126_LINK_STATE_UNKNOWN 2 + /*****************************************************************************/ //#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) -#if (( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27) ) || \ - (( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) ) && \ - ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) ))) +#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)) || \ + ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && \ + (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3)))) /* copied from linux kernel 2.6.20 include/linux/netdev.h */ #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) @@ -864,7 +1018,7 @@ extern void __chk_io_ptr(void __iomem *); /*****************************************************************************/ /* 2.5.28 => 2.4.23 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) ) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28)) static inline void _kc_synchronize_irq(void) { @@ -885,12 +1039,12 @@ static inline void _kc_synchronize_irq(void) /*****************************************************************************/ /* 2.6.4 => 2.6.0 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)) #define MODULE_VERSION(_version) MODULE_INFO(version, _version) #endif /* 2.6.4 => 2.6.0 */ /*****************************************************************************/ /* 2.6.0 => 2.5.28 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) ) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) #define MODULE_INFO(version, _version) #ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT #define CONFIG_E1000_DISABLE_PACKET_SPLIT 1 @@ -921,13 +1075,13 @@ static inline int _kc_pci_dma_mapping_error(dma_addr_t dma_addr) /*****************************************************************************/ /* 2.4.22 => 2.4.17 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22) ) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22)) #define pci_name(x) ((x)->slot_name) #endif /* 2.4.22 => 2.4.17 */ /*****************************************************************************/ /* 2.6.5 => 2.6.0 */ -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) ) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)) #define pci_dma_sync_single_for_cpu pci_dma_sync_single #define pci_dma_sync_single_for_device pci_dma_sync_single_for_cpu #endif /* 2.6.5 => 2.6.0 */ @@ -1411,6 +1565,26 @@ enum RTL8126_registers { PPS_RISE_TIME_S_8125 = 0x68A4, PTP_EGRESS_TIME_BASE_NS_8125 = 0XCF20, PTP_EGRESS_TIME_BASE_S_8125 = 0XCF24, + PTP_CTL = 0xE400, + PTP_INER = 0xE402, + PTP_INSR = 0xE404, + PTP_SYNCE_CTL = 0xE406, + PTP_GEN_CFG = 0xE408, + PTP_CLK_CFG_8126 = 0xE410, + PTP_CFG_NS_LO_8126 = 0xE412, + PTP_CFG_NS_HI_8126 = 0xE414, + PTP_CFG_S_LO_8126 = 0xE416, + PTP_CFG_S_MI_8126 = 0xE418, + PTP_CFG_S_HI_8126 = 0xE41A, + PTP_TAI_CFG = 0xE420, + PTP_TAI_TS_S_LO = 0xE42A, + PTP_TAI_TS_S_HI = 0xE42C, + PTP_TRX_TS_STA = 0xE430, + PTP_TRX_TS_NS_LO = 0xE446, + PTP_TRX_TS_NS_HI = 0xE448, + PTP_TRX_TS_S_LO = 0xE44A, + PTP_TRX_TS_S_MI = 0xE44C, + PTP_TRX_TS_S_HI = 0xE44E, //TCAM TCAM_NOTVALID_ADDR = 0xA000, @@ -1451,6 +1625,10 @@ enum RTL8126_register_content { RxRUNT_V3 = (1 << 19), RxCRC_V3 = (1 << 17), + RxRES_V4 = (1 << 22), + RxRUNT_V4 = (1 << 21), + RxCRC_V4 = (1 << 20), + /* ChipCmdBits */ StopReq = 0x80, CmdReset = 0x10, @@ -1485,6 +1663,7 @@ enum RTL8126_register_content { Reserved2_shift = 13, RxCfgDMAShift = 8, EnableRxDescV3 = (1 << 24), + EnableRxDescV4_1 = (1 << 24), EnableOuterVlan = (1 << 23), EnableInnerVlan = (1 << 22), RxCfg_128_int_en = (1 << 15), @@ -1690,6 +1869,11 @@ enum _DescStatusBit { FirstFrag_V3 = (1 << 25), /* First segment of a packet */ LastFrag_V3 = (1 << 24), /* Final segment of a packet */ + DescOwn_V4 = (DescOwn), /* Descriptor is owned by NIC */ + RingEnd_V4 = (RingEnd), /* End of descriptor ring */ + FirstFrag_V4 = (FirstFrag), /* First segment of a packet */ + LastFrag_V4 = (LastFrag), /* Final segment of a packet */ + /* Tx private */ /*------ offset 0 of tx descriptor ------*/ LargeSend = (1 << 27), /* TCP Large Send Offload (TSO) */ @@ -1748,7 +1932,7 @@ enum _DescStatusBit { RxIPF_v3 = (1 << 26), /* IP checksum failed */ RxUDPF_v3 = (1 << 25), /* UDP/IP checksum failed */ RxTCPF_v3 = (1 << 24), /* TCP/IP checksum failed */ - RxSCTPF_v3 = (1 << 23), /* TCP/IP checksum failed */ + RxSCTPF_v3 = (1 << 23), /* SCTP checksum failed */ RxVlanTag_v3 = (RxVlanTag), /* VLAN tag available */ /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ @@ -1761,6 +1945,23 @@ enum _DescStatusBit { RxV6F_v3 = (RxV6F), RxV4F_v3 = (RxV4F), /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ + + RxIPF_v4 = (1 << 17), /* IP checksum failed */ + RxUDPF_v4 = (1 << 16), /* UDP/IP checksum failed */ + RxTCPF_v4 = (1 << 15), /* TCP/IP checksum failed */ + RxSCTPF_v4 = (1 << 19), /* SCTP checksum failed */ + RxVlanTag_v4 = (RxVlanTag), /* VLAN tag available */ + + /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ + RxUDPT_v4 = (1 << 19), + RxTCPT_v4 = (1 << 18), + RxSCTP_v4 = (1 << 19), + /*@@@@@@ offset 0 of rx descriptor => bits for RTL8125 only end @@@@@@*/ + + /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only begin @@@@@@*/ + RxV6F_v4 = (RxV6F), + RxV4F_v4 = (RxV4F), + /*@@@@@@ offset 4 of rx descriptor => bits for RTL8125 only end @@@@@@*/ }; enum features { @@ -1829,6 +2030,7 @@ enum efuse { }; #define RsvdMask 0x3fffc000 #define RsvdMaskV3 0x3fff8000 +#define RsvdMaskV4 RsvdMaskV3 struct TxDesc { u32 opts1; @@ -1895,6 +2097,22 @@ struct RxDescV3 { }; }; +struct RxDescV4 { + union { + u64 addr; + + struct { + u32 RSSInfo; + u32 RSSResult; + } RxDescNormalDDWord1; + }; + + struct { + u32 opts2; + u32 opts1; + } RxDescNormalDDWord2; +}; + enum rxdesc_type { RXDESC_TYPE_NORMAL=0, RXDESC_TYPE_NEXT, @@ -1914,7 +2132,8 @@ enum rx_desc_ring_type { enum rx_desc_len { RX_DESC_LEN_TYPE_1 = (sizeof(struct RxDesc)), - RX_DESC_LEN_TYPE_3 = (sizeof(struct RxDescV3)) + RX_DESC_LEN_TYPE_3 = (sizeof(struct RxDescV3)), + RX_DESC_LEN_TYPE_4 = (sizeof(struct RxDescV4)) }; struct ring_info { @@ -2245,6 +2464,22 @@ enum rtl8126_state_t { __RTL8126_PTP_TX_IN_PROGRESS, }; +#define RTL_FLAG_RX_HWTSTAMP_ENABLED BIT_0 + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) +struct ethtool_eee { + __u32 cmd; + __u32 supported; + __u32 advertised; + __u32 lp_advertised; + __u32 eee_active; + __u32 eee_enabled; + __u32 tx_lpi_enabled; + __u32 tx_lpi_timer; + __u32 reserved[2]; +}; +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ + struct rtl8126_private { void __iomem *mmio_addr; /* memory map physical address */ struct pci_dev *pci_dev; /* Index of PCI device */ @@ -2258,6 +2493,7 @@ struct rtl8126_private { //struct msix_entry msix_entries[R8126_MAX_MSIX_VEC]; struct net_device_stats stats; /* statistics of net device */ unsigned long state; + u32 flags; u32 msg_enable; u32 tx_tcp_csum_cmd; @@ -2304,8 +2540,8 @@ struct rtl8126_private { u16 cp_cmd; u32 intr_mask; u32 timer_intr_mask; - u16 isr_reg[R8126_MAX_QUEUES]; - u16 imr_reg[R8126_MAX_QUEUES]; + u16 isr_reg[R8126_MAX_MSIX_VEC]; + u16 imr_reg[R8126_MAX_MSIX_VEC]; int phy_auto_nego_reg; int phy_1000_ctrl_reg; int phy_2500_ctrl_reg; @@ -2389,7 +2625,6 @@ struct rtl8126_private { u32 HwFiberModeVer; u32 HwFiberStat; - u8 HwSwitchMdiToFiber; u16 NicCustLedValue; @@ -2521,7 +2756,7 @@ struct rtl8126_private { //Realwow-------------- #endif //ENABLE_REALWOW_SUPPORT - struct ethtool_eee eee; + struct ethtool_keee eee; #ifdef ENABLE_R8126_PROCFS //Procfs support @@ -2534,9 +2769,12 @@ struct rtl8126_private { DECLARE_BITMAP(sysfs_flag, R8126_SYSFS_FLAG_MAX); u32 testmode; #endif + u8 HwSuppRxDescType; u8 InitRxDescType; u16 RxDescLength; //V1 16 Byte V2 32 Bytes + spinlock_t phy_lock; + u8 HwSuppPtpVer; u8 EnablePtp; u8 ptp_master_mode; @@ -2549,6 +2787,9 @@ struct rtl8126_private { unsigned long ptp_tx_start; struct ptp_clock_info ptp_clock_info; struct ptp_clock *ptp_clock; + u8 syncE_en; + u8 pps_enable; + struct hrtimer pps_timer; #endif u8 HwSuppRssVer; @@ -2672,7 +2913,7 @@ enum mcfg { //Ram Code Version #define NIC_RAMCODE_VERSION_CFG_METHOD_1 (0x0023) #define NIC_RAMCODE_VERSION_CFG_METHOD_2 (0x0033) -#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0048) +#define NIC_RAMCODE_VERSION_CFG_METHOD_3 (0x0060) //hwoptimize #define HW_PATCH_SOC_LAN (BIT_0) @@ -2713,17 +2954,25 @@ 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); +void rtl8126_mark_as_last_descriptor(struct rtl8126_private *tp, struct RxDesc *desc); static inline void rtl8126_make_unusable_by_asic(struct rtl8126_private *tp, struct RxDesc *desc) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: ((struct RxDescV3 *)desc)->addr = RTL8126_MAGIC_NUMBER; ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV3); - } else { + break; + case RX_DESC_RING_TYPE_4: + ((struct RxDescV4 *)desc)->addr = RTL8126_MAGIC_NUMBER; + ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts1 &= ~cpu_to_le32(DescOwn | RsvdMaskV4); + break; + default: desc->addr = RTL8126_MAGIC_NUMBER; desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); + break; } } @@ -2764,12 +3013,21 @@ 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); +void rtl8126_mdio_direct_write_phy_ocp(struct rtl8126_private *tp, u16 RegAddr,u16 value); +u32 rtl8126_mdio_direct_read_phy_ocp(struct rtl8126_private *tp, u16 RegAddr); +void rtl8126_clear_and_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 clearmask, u16 setmask); +void rtl8126_clear_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask); +void rtl8126_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask); + +void rtl8126_clear_mac_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask); +void rtl8126_set_mac_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask); + #ifndef ENABLE_LIB_SUPPORT 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 ) +#define HW_SUPPORT_CHECK_PHY_DISABLE_MODE(_M) ((_M)->HwSuppCheckPhyDisableModeVer > 0) #define HW_HAS_WRITE_PHY_MCU_RAM_CODE(_M) (((_M)->HwHasWrRamCodeToMicroP == TRUE) ? 1 : 0) #define HW_SUPPORT_D0_SPEED_UP(_M) ((_M)->HwSuppD0SpeedUpVer > 0) #define HW_SUPPORT_MAC_MCU(_M) ((_M)->HwSuppMacMcuVer > 0) diff --git a/r8126_dash.h b/r8126_dash.h index b0a2f11..40937eb 100644 --- a/r8126_dash.h +++ b/r8126_dash.h @@ -175,10 +175,10 @@ RX_DASH_BUFFER_TYPE_2, *PRX_DASH_BUFFER_TYPE_2; #define OCP_REG_CONFIG0_DRV_WAIT_OOB BIT_8 #define OCP_REG_CONFIG0_TLSEN BIT_7 -#define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0 ) -#define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1 ) -#define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2 ) -#define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3 ) +#define HW_DASH_SUPPORT_DASH(_M) ((_M)->HwSuppDashVer > 0) +#define HW_DASH_SUPPORT_TYPE_1(_M) ((_M)->HwSuppDashVer == 1) +#define HW_DASH_SUPPORT_TYPE_2(_M) ((_M)->HwSuppDashVer == 2) +#define HW_DASH_SUPPORT_TYPE_3(_M) ((_M)->HwSuppDashVer == 3) #define RECV_FROM_FW_BUF_SIZE (1520) #define SEND_TO_FW_BUF_SIZE (1520) diff --git a/r8126_n.c b/r8126_n.c index d01c7ef..1c920de 100644 --- a/r8126_n.c +++ b/r8126_n.c @@ -120,7 +120,7 @@ static const struct { } rtl_chip_info[] = { _R("RTL8126A", CFG_METHOD_1, - Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_unlimited << RxCfgDMAShift), + Rx_Fetch_Number_8 | RxCfg_pause_slot_en | EnableInnerVlan | EnableOuterVlan | (RX_DMA_BURST_512 << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_9k), @@ -138,7 +138,7 @@ static const struct { _R("Unknown", CFG_METHOD_DEFAULT, - (RX_DMA_BURST_unlimited << RxCfgDMAShift), + (RX_DMA_BURST_512 << RxCfgDMAShift), 0xff7e5880, Jumbo_Frame_1k) }; @@ -326,11 +326,6 @@ 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 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); @@ -465,7 +460,7 @@ struct _kc_ethtool_ops { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) #ifndef SET_ETHTOOL_OPS #define SET_ETHTOOL_OPS(netdev,ops) \ - ( (netdev)->ethtool_ops = (ops) ) + ((netdev)->ethtool_ops = (ops)) #endif //SET_ETHTOOL_OPS #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0) @@ -1029,7 +1024,6 @@ static int proc_get_driver_variable(struct seq_file *m, void *v) seq_printf(m, "HwSuppNowIsOobVer\t0x%x\n", tp->HwSuppNowIsOobVer); seq_printf(m, "HwFiberModeVer\t0x%x\n", tp->HwFiberModeVer); seq_printf(m, "HwFiberStat\t0x%x\n", tp->HwFiberStat); - seq_printf(m, "HwSwitchMdiToFiber\t0x%x\n", tp->HwSwitchMdiToFiber); seq_printf(m, "NicCustLedValue\t0x%x\n", tp->NicCustLedValue); seq_printf(m, "RequiredSecLanDonglePatch\t0x%x\n", tp->RequiredSecLanDonglePatch); seq_printf(m, "HwSuppDashVer\t0x%x\n", tp->HwSuppDashVer); @@ -1290,13 +1284,14 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) { struct net_device *dev = m->private; int i, n, max = R8126_PHY_REGS_SIZE/2; + unsigned long flags; u16 word_rd; struct rtl8126_private *tp = netdev_priv(dev); seq_puts(m, "\nDump Ethernet PHY\n"); seq_puts(m, "\nOffset\tValue\n------\t-----\n "); - rtnl_lock(); + spin_lock_irqsave(&tp->phy_lock, flags); seq_puts(m, "\n####################page 0##################\n "); rtl8126_mdio_write(tp, 0x1f, 0x0000); @@ -1348,7 +1343,7 @@ static int proc_get_eth_phy(struct seq_file *m, void *v) seq_printf(m, "%04x ", word_rd); } - rtnl_unlock(); + spin_unlock_irqrestore(&tp->phy_lock, flags); seq_putc(m, '\n'); return 0; @@ -1754,7 +1749,6 @@ static int proc_get_driver_variable(char *page, char **start, "HwSuppNowIsOobVer\t0x%x\n" "HwFiberModeVer\t0x%x\n" "HwFiberStat\t0x%x\n" - "HwSwitchMdiToFiber\t0x%x\n" "NicCustLedValue\t0x%x\n" "RequiredSecLanDonglePatch\t0x%x\n" "HwSuppDashVer\t0x%x\n" @@ -1881,7 +1875,6 @@ static int proc_get_driver_variable(char *page, char **start, tp->HwSuppNowIsOobVer, tp->HwFiberModeVer, tp->HwFiberStat, - tp->HwSwitchMdiToFiber, tp->NicCustLedValue, tp->RequiredSecLanDonglePatch, tp->HwSuppDashVer, @@ -1942,8 +1935,7 @@ static int proc_get_driver_variable(char *page, char **start, #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) dev->perm_addr, #endif - dev->dev_addr - ); + dev->dev_addr); rtnl_unlock(); @@ -1994,33 +1986,33 @@ static int proc_get_tally_counter(char *page, char **start, "rx_broadcast\t%lld\n" "rx_multicast\t%d\n" "tx_aborted\t%d\n" - "tx_underrun\t%d\n", - - "tx_octets\t%lld\n", - "rx_octets\t%lld\n", - "rx_multicast64\t%lld\n", - "tx_unicast64\t%lld\n", - "tx_broadcast64\t%lld\n", - "tx_multicast64\t%lld\n", - "tx_pause_on\t%d\n", - "tx_pause_off\t%d\n", - "tx_pause_all\t%d\n", - "tx_deferred\t%d\n", - "tx_late_collision\t%d\n", - "tx_all_collision\t%d\n", - "tx_aborted32\t%d\n", - "align_errors32\t%d\n", - "rx_frame_too_long\t%d\n", - "rx_runt\t%d\n", - "rx_pause_on\t%d\n", - "rx_pause_off\t%d\n", - "rx_pause_all\t%d\n", - "rx_unknown_opcode\t%d\n", - "rx_mac_error\t%d\n", - "tx_underrun32\t%d\n", - "rx_mac_missed\t%d\n", - "rx_tcam_dropped\t%d\n", - "tdu\t%d\n", + "tx_underrun\t%d\n" + + "tx_octets\t%lld\n" + "rx_octets\t%lld\n" + "rx_multicast64\t%lld\n" + "tx_unicast64\t%lld\n" + "tx_broadcast64\t%lld\n" + "tx_multicast64\t%lld\n" + "tx_pause_on\t%d\n" + "tx_pause_off\t%d\n" + "tx_pause_all\t%d\n" + "tx_deferred\t%d\n" + "tx_late_collision\t%d\n" + "tx_all_collision\t%d\n" + "tx_aborted32\t%d\n" + "align_errors32\t%d\n" + "rx_frame_too_long\t%d\n" + "rx_runt\t%d\n" + "rx_pause_on\t%d\n" + "rx_pause_off\t%d\n" + "rx_pause_all\t%d\n" + "rx_unknown_opcode\t%d\n" + "rx_mac_error\t%d\n" + "tx_underrun32\t%d\n" + "rx_mac_missed\t%d\n" + "rx_tcam_dropped\t%d\n" + "tdu\t%d\n" "rdu\t%d\n", le64_to_cpu(counters->tx_packets), le64_to_cpu(counters->rx_packets), @@ -2061,8 +2053,7 @@ static int proc_get_tally_counter(char *page, char **start, le32_to_cpu(counters->rx_mac_missed), le32_to_cpu(counters->rx_tcam_dropped), le32_to_cpu(counters->tdu), - le32_to_cpu(counters->rdu), - ); + le32_to_cpu(counters->rdu)); len += snprintf(page + len, count - len, "\n"); out_unlock: @@ -2478,10 +2469,10 @@ static int proc_get_temperature(char *page, char **start, return len; } -static int proc_get_cable_info(char *page, char **start, - off_t offset, int count, - int *eof, void *data, - bool poe_mode) +static int _proc_get_cable_info(char *page, char **start, + off_t offset, int count, + int *eof, void *data, + bool poe_mode) { int i; u16 status; @@ -2497,7 +2488,7 @@ static int proc_get_cable_info(char *page, char **start, return -EOPNOTSUPP; } - rtnl_lock(); + spin_lock_irqsave(&tp->phy_lock, flags); if (!rtl8126_sysfs_testmode_on(tp)) { len += snprintf(page + len, count - len, @@ -2542,7 +2533,7 @@ static int proc_get_cable_info(char *page, char **start, len += snprintf(page + len, count - len, "\n"); out_unlock: - rtnl_unlock(); + spin_unlock_irqrestore(&tp->phy_lock, flags); *eof = 1; return len; @@ -2552,21 +2543,21 @@ static int proc_get_cable_info(char *page, char **start, off_t offset, int count, int *eof, void *data) { - return proc_get_cable_info(page, start, offset, count, eof, data, 0); + return _proc_get_cable_info(page, start, offset, count, eof, data, 0); } static int proc_get_poe_cable_info(char *page, char **start, off_t offset, int count, int *eof, void *data) { - return proc_get_cable_info(page, start, offset, count, eof, data, 1); + return _proc_get_cable_info(page, start, offset, count, eof, data, 1); } static void _proc_dump_desc(char *page, int *page_len, int *count, void *desc_base, u32 alloc_size) { u32 *pdword; - int i; + int i, len; if (desc_base == NULL || alloc_size == 0) @@ -2594,6 +2585,7 @@ static int proc_dump_rx_desc(char *page, char **start, off_t offset, int count, int *eof, void *data) { + int i; int len = 0; struct net_device *dev = data; struct rtl8126_private *tp = netdev_priv(dev); @@ -2607,7 +2599,7 @@ static int proc_dump_rx_desc(char *page, char **start, continue; len += snprintf(page + len, count - len, - "\ndump rx &d desc:%d", + "\ndump rx %d desc:%d", i, ring->num_rx_desc); _proc_dump_desc(page, &len, &count, @@ -3092,9 +3084,9 @@ static void mdio_real_direct_write_phy_ocp(struct rtl8126_private *tp, } } -static void rtl8126_mdio_direct_write_phy_ocp(struct rtl8126_private *tp, - u16 RegAddr, - u16 value) +void rtl8126_mdio_direct_write_phy_ocp(struct rtl8126_private *tp, + u16 RegAddr, + u16 value) { if (tp->rtk_enable_diag) return; @@ -3187,8 +3179,8 @@ static u32 mdio_real_direct_read_phy_ocp(struct rtl8126_private *tp, return value; } -static u32 rtl8126_mdio_direct_read_phy_ocp(struct rtl8126_private *tp, - u16 RegAddr) +u32 rtl8126_mdio_direct_read_phy_ocp(struct rtl8126_private *tp, + u16 RegAddr) { if (tp->rtk_enable_diag) return 0xffffffff; @@ -3273,7 +3265,7 @@ void rtl8126_set_eth_phy_bit(struct rtl8126_private *tp, u8 addr, u16 mask) mask); } -static void rtl8126_clear_and_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 clearmask, u16 setmask) +void rtl8126_clear_and_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 clearmask, u16 setmask) { u16 PhyRegValue; @@ -3283,7 +3275,7 @@ static void rtl8126_clear_and_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u1 rtl8126_mdio_direct_write_phy_ocp(tp, addr, PhyRegValue); } -static void rtl8126_clear_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask) +void rtl8126_clear_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask) { rtl8126_clear_and_set_eth_phy_ocp_bit(tp, addr, @@ -3291,7 +3283,7 @@ static void rtl8126_clear_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, 0); } -static void rtl8126_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask) +void rtl8126_set_eth_phy_ocp_bit(struct rtl8126_private *tp, u16 addr, u16 mask) { rtl8126_clear_and_set_eth_phy_ocp_bit(tp, addr, @@ -3366,7 +3358,7 @@ rtl8126_clear_set_mac_ocp_bit( rtl8126_mac_ocp_write(tp, addr, PhyRegValue); } -static void +void rtl8126_clear_mac_ocp_bit( struct rtl8126_private *tp, u16 addr, @@ -3379,7 +3371,7 @@ rtl8126_clear_mac_ocp_bit( 0); } -static void +void rtl8126_set_mac_ocp_bit( struct rtl8126_private *tp, u16 addr, @@ -3556,9 +3548,8 @@ void rtl8126_dash2_enable_tx(struct rtl8126_private *tp) if (!tp->DASH) return; - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + 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 rtl8126_dash2_disable_rx(struct rtl8126_private *tp) @@ -3566,9 +3557,8 @@ void rtl8126_dash2_disable_rx(struct rtl8126_private *tp) if (!tp->DASH) return; - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) RTL_CMAC_W8(tp, CMAC_IBCR0, RTL_CMAC_R8(tp, CMAC_IBCR0) & ~(BIT_0)); - } } void rtl8126_dash2_enable_rx(struct rtl8126_private *tp) @@ -3576,9 +3566,8 @@ void rtl8126_dash2_enable_rx(struct rtl8126_private *tp) if (!tp->DASH) return; - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + 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 rtl8126_dash2_disable_txrx(struct net_device *dev) @@ -4091,6 +4080,8 @@ rtl8126_stop_all_request(struct net_device *dev) struct rtl8126_private *tp = netdev_priv(dev); RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) | StopReq); + udelay(200); + RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) & (CmdTxEnb | CmdRxEnb)); return 1; } @@ -4142,9 +4133,8 @@ rtl8126_enable_dash2_interrupt(struct rtl8126_private *tp) if (!tp->DASH) return; - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) RTL_CMAC_W8(tp, CMAC_IBIMR0, (ISRIMR_DASH_TYPE2_ROK | ISRIMR_DASH_TYPE2_TOK | ISRIMR_DASH_TYPE2_TDU | ISRIMR_DASH_TYPE2_RDU | ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE)); - } } static inline void @@ -4153,9 +4143,8 @@ rtl8126_disable_dash2_interrupt(struct rtl8126_private *tp) if (!tp->DASH) return; - if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) { + if (HW_DASH_SUPPORT_TYPE_2(tp) || HW_DASH_SUPPORT_TYPE_3(tp)) RTL_CMAC_W8(tp, CMAC_IBIMR0, 0); - } } #endif @@ -4469,9 +4458,12 @@ rtl8126_xmii_reset_pending(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); unsigned int retval; + unsigned long flags; + spin_lock_irqsave(&tp->phy_lock, flags); rtl8126_mdio_write(tp, 0x1f, 0x0000); retval = rtl8126_mdio_read(tp, MII_BMCR) & BMCR_RESET; + spin_unlock_irqrestore(&tp->phy_lock, flags); return retval; } @@ -4509,10 +4501,14 @@ static void rtl8126_xmii_reset_enable(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; + int ret; if (rtl8126_is_in_phy_disable_mode(dev)) return; + spin_lock_irqsave(&tp->phy_lock, flags); + rtl8126_mdio_write(tp, 0x1f, 0x0000); rtl8126_mdio_write(tp, MII_ADVERTISE, rtl8126_mdio_read(tp, MII_ADVERTISE) & ~(ADVERTISE_10HALF | ADVERTISE_10FULL | @@ -4523,10 +4519,11 @@ rtl8126_xmii_reset_enable(struct net_device *dev) ~(RTK_ADVERTISE_2500FULL | RTK_ADVERTISE_5000FULL)); rtl8126_mdio_write(tp, MII_BMCR, BMCR_RESET | BMCR_ANENABLE); - if (rtl8126_wait_phy_reset_complete(tp) == 0) - return; + ret = rtl8126_wait_phy_reset_complete(tp); + + spin_unlock_irqrestore(&tp->phy_lock, flags); - if (netif_msg_link(tp)) + if (ret != 0 && netif_msg_link(tp)) printk(KERN_ERR "%s: PHY reset failed.\n", dev->name); } @@ -4671,6 +4668,7 @@ static void rtl8126_link_on_patch(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; rtl8126_hw_config(dev); @@ -4691,10 +4689,17 @@ rtl8126_link_on_patch(struct net_device *dev) netif_tx_wake_all_queues(dev); + spin_lock_irqsave(&tp->phy_lock, flags); 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); + spin_unlock_irqrestore(&tp->phy_lock, flags); + +#ifdef ENABLE_PTP_SUPPORT + if (tp->EnablePtp) + rtl8126_set_local_time(tp); +#endif // ENABLE_PTP_SUPPORT } static void @@ -4734,18 +4739,21 @@ rtl8126_link_down_patch(struct net_device *dev) //rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); #ifdef ENABLE_DASH_SUPPORT - if (tp->DASH) { + if (tp->DASH) NICChkTypeEnableDashInterrupt(tp); - } #endif } static void -_rtl8126_check_link_status(struct net_device *dev) +_rtl8126_check_link_status(struct net_device *dev, unsigned int link_state) { struct rtl8126_private *tp = netdev_priv(dev); - if (tp->link_ok(dev)) { + if (link_state != R8126_LINK_STATE_OFF && + link_state != R8126_LINK_STATE_ON) + link_state = tp->link_ok(dev); + + if (link_state == R8126_LINK_STATE_ON) { rtl8126_link_on_patch(dev); if (netif_msg_ifup(tp)) @@ -4762,10 +4770,15 @@ static void rtl8126_check_link_status(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); - - _rtl8126_check_link_status(dev); + unsigned int link_status_on; tp->resume_not_chg_speed = 0; + + link_status_on = tp->link_ok(dev); + if (netif_carrier_ok(dev) == link_status_on) + rtl8126_enable_hw_linkchg_interrupt(tp); + else + _rtl8126_check_link_status(dev, link_status_on); } static bool @@ -5408,6 +5421,7 @@ static void rtl8126_set_wol_link_speed(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; int auto_nego; int giga_ctrl; int ctrl_2500; @@ -5417,6 +5431,8 @@ rtl8126_set_wol_link_speed(struct net_device *dev) u16 status_2500; u16 aner; + spin_lock_irqsave(&tp->phy_lock, flags); + if (tp->autoneg != AUTONEG_ENABLE) goto exit; @@ -5498,6 +5514,8 @@ rtl8126_set_wol_link_speed(struct net_device *dev) rtl8126_phy_restart_nway(dev); exit: + spin_unlock_irqrestore(&tp->phy_lock, flags); + return; } @@ -5506,8 +5524,10 @@ rtl8126_keep_wol_link_speed(struct net_device *dev, u8 from_suspend) { struct rtl8126_private *tp = netdev_priv(dev); - if ((from_suspend && !tp->link_ok(dev)) || - (!from_suspend && tp->resume_not_chg_speed)) + if (from_suspend && tp->link_ok(dev) && (tp->wol_opts & WAKE_PHY)) + return 1; + + if (!from_suspend && tp->resume_not_chg_speed) return 1; return 0; @@ -5534,11 +5554,15 @@ rtl8126_powerdown_pll(struct net_device *dev, u8 from_suspend) /* Enable the PME and clear the status */ rtl8126_set_pci_pme(tp, 1); +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(tp)) + return; +#endif /* ENABLE_FIBER_SUPPORT */ + if (rtl8126_keep_wol_link_speed(dev, from_suspend)) { - if (tp->wol_opts & WAKE_PHY) - tp->check_keep_link_speed = 1; + tp->check_keep_link_speed = 1; } else { - if (HW_SUPPORT_D0_SPEED_UP(tp)) { + if (tp->D0SpeedUpSpeed != D0_SPEED_UP_SPEED_DISABLE) { rtl8126_enable_d0_speedup(tp); tp->check_keep_link_speed = 1; } @@ -5551,6 +5575,11 @@ rtl8126_powerdown_pll(struct net_device *dev, u8 from_suspend) return; } +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(tp)) + return; +#endif /* ENABLE_FIBER_SUPPORT */ + if (tp->DASH) return; @@ -5685,11 +5714,14 @@ rtl8126_set_speed_xmii(struct net_device *dev, u64 adv) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; int auto_nego = 0; int giga_ctrl = 0; int ctrl_2500 = 0; int rc = -EINVAL; + spin_lock_irqsave(&tp->phy_lock, flags); + //Disable Giga Lite rtl8126_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_9); rtl8126_clear_eth_phy_ocp_bit(tp, 0xA5EA, BIT_0); @@ -5765,6 +5797,8 @@ rtl8126_set_speed_xmii(struct net_device *dev, rc = 0; out: + spin_unlock_irqrestore(&tp->phy_lock, flags); + return rc; } @@ -5845,7 +5879,6 @@ rtl8126_set_settings(struct net_device *dev, static u32 rtl8126_get_tx_csum(struct net_device *dev) { - struct rtl8126_private *tp = netdev_priv(dev); u32 ret; #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0) @@ -5917,20 +5950,28 @@ static u32 rtl8126_rx_desc_opts1(struct rtl8126_private *tp, struct RxDesc *desc) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: return ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts1; - else + case RX_DESC_RING_TYPE_4: + return ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts1; + default: return desc->opts1; + } } static u32 rtl8126_rx_desc_opts2(struct rtl8126_private *tp, struct RxDesc *desc) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: return ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts2; - else + case RX_DESC_RING_TYPE_4: + return ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts2; + default: return desc->opts2; + } } #ifdef CONFIG_R8126_VLAN @@ -5939,12 +5980,20 @@ static void rtl8126_clear_rx_desc_opts2(struct rtl8126_private *tp, struct RxDesc *desc) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: ((struct RxDescV3 *)desc)->RxDescNormalDDWord4.opts2 = 0; - else + break; + case RX_DESC_RING_TYPE_4: + ((struct RxDescV4 *)desc)->RxDescNormalDDWord2.opts2 = 0; + break; + default: desc->opts2 = 0; + break; + } } + static inline u32 rtl8126_tx_vlan_tag(struct rtl8126_private *tp, struct sk_buff *skb) @@ -6141,6 +6190,7 @@ static void rtl8126_gset_xmii(struct net_device *dev, u16 anlpar = tp->phy_reg_anlpar; u16 gbsr = tp->phy_reg_gbsr; u16 status_2500 = tp->phy_reg_status_2500; + unsigned long flags; u64 lpa_adv = 0; u16 status; u8 autoneg, duplex; @@ -6155,6 +6205,7 @@ static void rtl8126_gset_xmii(struct net_device *dev, SUPPORTED_100baseT_Full | SUPPORTED_1000baseT_Full | SUPPORTED_2500baseX_Full | + RTK_SUPPORTED_5000baseX_Full | SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_Pause | @@ -6163,6 +6214,9 @@ static void rtl8126_gset_xmii(struct net_device *dev, if (!HW_SUPP_PHY_LINK_SPEED_2500M(tp)) supported &= ~SUPPORTED_2500baseX_Full; + if (!HW_SUPP_PHY_LINK_SPEED_5000M(tp)) + supported &= ~RTK_SUPPORTED_5000baseX_Full; + advertising = tp->advertising; if (tp->phy_auto_nego_reg || tp->phy_1000_ctrl_reg || tp->phy_2500_ctrl_reg) { @@ -6183,8 +6237,10 @@ static void rtl8126_gset_xmii(struct net_device *dev, advertising |= RTK_ADVERTISED_5000baseX_Full; } + spin_lock_irqsave(&tp->phy_lock, flags); rtl8126_mdio_write(tp, 0x1F, 0x0000); bmcr = rtl8126_mdio_read(tp, MII_BMCR); + spin_unlock_irqrestore(&tp->phy_lock, flags); if (bmcr & BMCR_ANENABLE) { autoneg = AUTONEG_ENABLE; advertising |= ADVERTISED_Autoneg; @@ -6258,29 +6314,25 @@ static void rtl8126_gset_xmii(struct net_device *dev, advertising); ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising, lpa_adv); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) + if (supported & SUPPORTED_2500baseX_Full) { - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, - cmd->link_modes.supported, 0); linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, cmd->link_modes.supported, 1); } if (advertising & ADVERTISED_2500baseX_Full) { - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, - cmd->link_modes.advertising, 0); linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, cmd->link_modes.advertising, 1); } - if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) { + if (supported & RTK_SUPPORTED_5000baseX_Full) { linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, cmd->link_modes.supported, 1); + } + if (advertising & RTK_ADVERTISED_5000baseX_Full) { linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, - cmd->link_modes.advertising, tp->phy_2500_ctrl_reg & RTK_ADVERTISE_5000FULL); + cmd->link_modes.advertising, 1); } if (report_lpa) { if (lpa_adv & ADVERTISED_2500baseX_Full) { - linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, - cmd->link_modes.lp_advertising, 0); linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, cmd->link_modes.lp_advertising, 1); } @@ -6288,7 +6340,20 @@ static void rtl8126_gset_xmii(struct net_device *dev, linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, cmd->link_modes.lp_advertising, 1); } -#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) + /* Use ETHTOOL_LINK_MODE_2500baseT_Full_BIT instead of + ETHTOOL_LINK_MODE_2500baseX_Full_BIT. */ + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, + cmd->link_modes.supported, 0); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, + cmd->link_modes.advertising, 0); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, + cmd->link_modes.lp_advertising, 0); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) */ + cmd->base.autoneg = autoneg; cmd->base.speed = speed; cmd->base.duplex = duplex; @@ -6798,8 +6863,9 @@ static void rtl8126_disable_adv_eee(struct rtl8126_private *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); + struct ethtool_keee *eee = &tp->eee; + u16 eee_adv_cap1_t = rtl8126_ethtool_adv_to_mmd_eee_adv_cap1_t(eee->advertised); + u16 eee_adv_cap2_t = rtl8126_ethtool_adv_to_mmd_eee_adv_cap2_t(eee->advertised); int ret; ret = 0; @@ -6812,14 +6878,11 @@ static int rtl8126_enable_eee(struct rtl8126_private *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) - rtl8126_set_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); - else - rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT); - if (HW_SUPP_PHY_LINK_SPEED_5000M(tp)) - rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_5GT); - + eee_adv_cap1_t); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xA6D4, + MDIO_EEE_2_5GT | MDIO_EEE_5GT, + eee_adv_cap2_t); 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); @@ -6847,9 +6910,7 @@ static int rtl8126_disable_eee(struct rtl8126_private *tp) rtl8126_clear_mac_ocp_bit(tp, 0xE040, (BIT_1|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)) - rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_5GT); + rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D4, MDIO_EEE_2_5GT | MDIO_EEE_5GT); rtl8126_clear_eth_phy_ocp_bit(tp, 0xA6D8, BIT_4); rtl8126_clear_eth_phy_ocp_bit(tp, 0xA428, BIT_7); @@ -6928,6 +6989,136 @@ rtl8126_device_lpi_t_to_ethtool_lpi_t(struct rtl8126_private *tp , u32 lpi_timer return to_us; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0) +static void +rtl8126_adv_to_linkmode(unsigned long *mode, u64 adv) +{ + linkmode_zero(mode); + + if (adv & ADVERTISED_10baseT_Half) + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, mode); + if (adv & ADVERTISED_10baseT_Full) + linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, mode); + if (adv & ADVERTISED_100baseT_Half) + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, mode); + if (adv & ADVERTISED_100baseT_Full) + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, mode); + if (adv & ADVERTISED_1000baseT_Half) + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, mode); + if (adv & ADVERTISED_1000baseT_Full) + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, mode); + if (adv & ADVERTISED_2500baseX_Full) + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, mode); + if (adv & RTK_ADVERTISED_5000baseX_Full) + linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, mode); +} + +static int +rtl_ethtool_get_eee(struct net_device *net, struct ethtool_keee *edata) +{ + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); + struct rtl8126_private *tp = netdev_priv(net); + struct ethtool_keee *eee = &tp->eee; + u32 tx_lpi_timer; + u16 val; + + if (unlikely(tp->rtk_enable_diag)) + return -EBUSY; + + /* Get LP advertisement EEE */ + val = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA5D2); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, val); + val = rtl8126_mdio_direct_read_phy_ocp(tp, 0xA6D0); + mii_eee_cap2_mod_linkmode_sup_t(edata->lp_advertised, val); + + /* Get EEE Tx LPI timer*/ + tx_lpi_timer = rtl8126_device_lpi_t_to_ethtool_lpi_t(tp, eee->tx_lpi_timer); + + val = rtl8126_mac_ocp_read(tp, 0xE040); + val &= BIT_1 | BIT_0; + + edata->eee_enabled = !!val; + linkmode_copy(edata->supported, eee->supported); + linkmode_copy(edata->advertised, eee->advertised); + edata->tx_lpi_enabled = edata->eee_enabled; + edata->tx_lpi_timer = tx_lpi_timer; + linkmode_and(common, edata->advertised, edata->lp_advertised); + edata->eee_active = !linkmode_empty(common); + + return 0; +} + +static int +rtl_ethtool_set_eee(struct net_device *net, struct ethtool_keee *edata) +{ + __ETHTOOL_DECLARE_LINK_MODE_MASK(advertising); + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp); + struct rtl8126_private *tp = netdev_priv(net); + struct ethtool_keee *eee = &tp->eee; + int rc = 0; + + if (!HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp) || + tp->DASH) + return -EOPNOTSUPP; + + if (unlikely(tp->rtk_enable_diag)) { + dev_printk(KERN_WARNING, tp_to_dev(tp), "Diag Enabled\n"); + rc = -EBUSY; + goto out; + } + + if (tp->autoneg != AUTONEG_ENABLE) { + dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE requires autoneg\n"); + rc = -EINVAL; + goto out; + } + + /* + if (edata->tx_lpi_enabled) { + if (edata->tx_lpi_timer > tp->max_jumbo_frame_size || + edata->tx_lpi_timer < ETH_MIN_MTU) { + dev_printk(KERN_WARNING, tp_to_dev(tp), "Valid LPI timer range is %d to %d. \n", + ETH_MIN_MTU, tp->max_jumbo_frame_size); + rc = -EINVAL; + goto out; + } + } + */ + + rtl8126_adv_to_linkmode(advertising, tp->advertising); + if (linkmode_empty(edata->advertised)) { + linkmode_and(edata->advertised, advertising, eee->supported); + } else if (linkmode_andnot(tmp, edata->advertised, advertising)) { + dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised must be a subset of autoneg advertised speeds\n"); + rc = -EINVAL; + goto out; + } + + if (linkmode_andnot(tmp, edata->advertised, eee->supported)) { + dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE advertised must be a subset of support \n"); + rc = -EINVAL; + goto out; + } + + //tp->eee.eee_enabled = edata->eee_enabled; + //tp->eee_adv_t = rtl8126_ethtool_adv_to_mmd_eee_adv_cap1_t(edata->advertised); + + linkmode_copy(eee->advertised, edata->advertised); + //eee->tx_lpi_enabled = edata->tx_lpi_enabled; + //eee->tx_lpi_timer = edata->tx_lpi_timer; + eee->eee_enabled = edata->eee_enabled; + + if (eee->eee_enabled) + rtl8126_enable_eee(tp); + else + rtl8126_disable_eee(tp); + + rtl_nway_reset(net); + +out: + return rc; +} +#else static int rtl_ethtool_get_eee(struct net_device *net, struct ethtool_eee *edata) { @@ -7027,9 +7218,6 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) //tp->eee.eee_enabled = edata->eee_enabled; //tp->eee_adv_t = ethtool_adv_to_mmd_eee_adv_t(edata->advertised); - dev_printk(KERN_WARNING, tp_to_dev(tp), "EEE tx_lpi_timer %x must be a subset of support %x\n", - edata->tx_lpi_timer, eee->tx_lpi_timer); - eee->advertised = edata->advertised; //eee->tx_lpi_enabled = edata->tx_lpi_enabled; //eee->tx_lpi_timer = edata->tx_lpi_timer; @@ -7042,14 +7230,25 @@ rtl_ethtool_set_eee(struct net_device *net, struct ethtool_eee *edata) rtl_nway_reset(net); - return rc; - out: - return rc; } +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,9,0) */ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +static void rtl8126_get_channels(struct net_device *dev, + struct ethtool_channels *channel) +{ + struct rtl8126_private *tp = netdev_priv(dev); + + channel->max_rx = tp->HwSuppNumRxQueues; + channel->max_tx = tp->HwSuppNumTxQueues; + channel->rx_count = tp->num_rx_rings; + channel->tx_count = tp->num_tx_rings; +} +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,22) static const struct ethtool_ops rtl8126_ethtool_ops = { .get_drvinfo = rtl8126_get_drvinfo, @@ -7120,6 +7319,9 @@ static const struct ethtool_ops rtl8126_ethtool_ops = { .get_eee = rtl_ethtool_get_eee, .set_eee = rtl_ethtool_set_eee, #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) + .get_channels = rtl8126_get_channels, +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) */ .nway_reset = rtl_nway_reset, }; @@ -7407,9 +7609,8 @@ _rtl8126_write_mac_mcu_ram_code(struct rtl8126_private *tp, const u16 *entry, u1 { u16 i; - for (i = 0; i < entry_cnt; i++) { + for (i = 0; i < entry_cnt; i++) rtl8126_mac_ocp_write(tp, 0xF800 + i * 2, entry[i]); - } } static void @@ -7475,13 +7676,214 @@ rtl8126_set_mac_mcu_8126a_1(struct net_device *dev) static void rtl8126_set_mac_mcu_8126a_2(struct net_device *dev) { + struct rtl8126_private *tp = netdev_priv(dev); + static const u16 mcu_patch_code_8126a_2[] = { + 0xE010, 0xE02C, 0xE04E, 0xE0A4, 0xE0A8, 0xE0AA, 0xE0AC, 0xE0AE, 0xE0B0, + 0xE0B2, 0xE0B4, 0xE0B6, 0xE0B8, 0xE0BA, 0xE0BC, 0xE0BE, 0xC716, 0xC616, + 0x9EE0, 0xC616, 0x65C0, 0x1500, 0xF009, 0xC714, 0x66E0, 0x41B5, 0x8EE0, + 0xC611, 0x75C0, 0x4858, 0x9DC0, 0xC707, 0xC608, 0x9EE0, 0xC608, 0xC502, + 0xBD00, 0x0100, 0xE86C, 0xE000, 0xA000, 0xB404, 0xB430, 0xC070, 0xE926, + 0xC2FE, 0x400A, 0xF11A, 0x63A4, 0x1A00, 0x49B0, 0xF002, 0x4820, 0x49B1, + 0xF002, 0x4821, 0x49B2, 0xF002, 0x4822, 0x49B3, 0xF002, 0x4823, 0xC411, + 0x6380, 0x48B0, 0x8B80, 0x6320, 0x41DA, 0x8B20, 0x6380, 0x4830, 0x8B80, + 0xE003, 0x73A4, 0x9B20, 0xC302, 0xBB00, 0x4A18, 0xC070, 0xE022, 0xC054, + 0x7102, 0x4992, 0xF149, 0x4893, 0x9902, 0x1B1F, 0xC74E, 0x72E0, 0x2521, + 0x48A5, 0x0B01, 0x1C4F, 0x9C00, 0x2121, 0x1D01, 0x41AA, 0x2521, 0x9DE0, + 0x4856, 0x9DE0, 0x1CCF, 0xE839, 0x48D6, 0x9DE0, 0x7102, 0x4996, 0xF1FE, + 0x4814, 0x9902, 0x1CFF, 0x0C01, 0x1400, 0xF00C, 0x7102, 0x4996, 0xF0FB, + 0x7102, 0x4990, 0xF0FE, 0x1C1F, 0xE826, 0x7102, 0x4992, 0xF004, 0x4813, + 0x9902, 0xE01D, 0x1300, 0xF104, 0x4817, 0x9902, 0xE018, 0x4894, 0x9902, + 0x4995, 0xF00B, 0x121F, 0xF0F3, 0x131E, 0xF003, 0x4998, 0xF0EF, 0x0201, + 0x4818, 0x9902, 0xE7C9, 0x1200, 0xF0E9, 0x4998, 0xF002, 0x1B01, 0x0A01, + 0x4898, 0x9902, 0xE7C0, 0xC00A, 0xC606, 0xBE00, 0x0C01, 0x1400, 0xF1FE, + 0xFF80, 0x2362, 0xD456, 0xD404, 0xE400, 0x4166, 0x9CF6, 0xC002, 0xB800, + 0x14A6, 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, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6847, + 0x0A18, 0x0409, 0x0A10 + }; + rtl8126_hw_disable_mac_mcu_bps(dev); + + rtl8126_write_mac_mcu_ram_code(tp, mcu_patch_code_8126a_2, ARRAY_SIZE(mcu_patch_code_8126a_2)); + + rtl8126_mac_ocp_write(tp, 0xFC26, 0x8000); + + //rtl8126_mac_ocp_write(tp, 0xFC28, 0x00FE); + //rtl8126_mac_ocp_write(tp, 0xFC2A, 0x4A14); + rtl8126_mac_ocp_write(tp, 0xFC2C, 0x2360); + rtl8126_mac_ocp_write(tp, 0xFC2E, 0x14A4); + + rtl8126_mac_ocp_write(tp, 0xFC48, 0x000C); } static void rtl8126_set_mac_mcu_8126a_3(struct net_device *dev) { + struct rtl8126_private *tp = netdev_priv(dev); + static const u16 mcu_patch_code_8126a_3[] = { + 0xE010, 0xE02C, 0xE04E, 0xE052, 0xE054, 0xE056, 0xE058, 0xE05A, 0xE05C, + 0xE05E, 0xE060, 0xE062, 0xE064, 0xE066, 0xE068, 0xE06A, 0xC716, 0xC616, + 0x9EE0, 0xC616, 0x65C0, 0x1500, 0xF009, 0xC714, 0x66E0, 0x41B5, 0x8EE0, + 0xC611, 0x75C0, 0x4858, 0x9DC0, 0xC707, 0xC608, 0x9EE0, 0xC608, 0xC502, + 0xBD00, 0x0100, 0xE86C, 0xE000, 0xA000, 0xB404, 0xB430, 0xC070, 0xE926, + 0xC2FE, 0x400A, 0xF11A, 0x63A4, 0x1A00, 0x49B0, 0xF002, 0x4820, 0x49B1, + 0xF002, 0x4821, 0x49B2, 0xF002, 0x4822, 0x49B3, 0xF002, 0x4823, 0xC411, + 0x6380, 0x48B0, 0x8B80, 0x6320, 0x41DA, 0x8B20, 0x6380, 0x4830, 0x8B80, + 0xE003, 0x73A4, 0x9B20, 0xC302, 0xBB00, 0x55E2, 0xC070, 0xE022, 0x4166, + 0x9CF6, 0xC602, 0xBE00, 0x14A6, 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, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, + 0x0000, 0xC602, 0xBE00, 0x0000, 0xC602, 0xBE00, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6847, + 0x0B18, 0x0409, 0x0A1C + }; + rtl8126_hw_disable_mac_mcu_bps(dev); + + rtl8126_write_mac_mcu_ram_code(tp, mcu_patch_code_8126a_3, ARRAY_SIZE(mcu_patch_code_8126a_3)); + + rtl8126_mac_ocp_write(tp, 0xFC26, 0x8000); + + //rtl8126_mac_ocp_write(tp, 0xFC28, 0x00FE); + //rtl8126_mac_ocp_write(tp, 0xFC2A, 0x55DE); + rtl8126_mac_ocp_write(tp, 0xFC2C, 0x14A4); + + rtl8126_mac_ocp_write(tp, 0xFC48, 0x0004); } static void @@ -7516,7 +7918,7 @@ static void rtl8126_release_firmware(struct rtl8126_private *tp) } } -void rtl8126_apply_firmware(struct rtl8126_private *tp) +static void rtl8126_apply_firmware(struct rtl8126_private *tp) { /* TODO: release firmware if rtl_fw_write_firmware signals failure. */ if (tp->rtl_fw) { @@ -7711,16 +8113,14 @@ rtl8126_set_phy_mcu_ram_code(struct net_device *dev, const u16 *ramcode, u16 cod u16 addr; u16 val; - if (ramcode == NULL || codesize % 2) { + if (ramcode == NULL || codesize % 2) goto out; - } for (i = 0; i < codesize; i += 2) { addr = ramcode[i]; val = ramcode[i + 1]; - if (addr == 0xFFFF && val == 0xFFFF) { + if (addr == 0xFFFF && val == 0xFFFF) break; - } rtl8126_mdio_direct_write_phy_ocp(tp, addr, val); } @@ -10125,308 +10525,523 @@ static const u16 phy_mcu_ram_code_8126a_3_1[] = { 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, 0x203c, 0xa438, 0xd707, 0xa438, 0x4121, 0xa438, 0xd706, + 0xa438, 0x40fc, 0xa438, 0xd70a, 0xa438, 0x40b5, 0xa438, 0xd028, + 0xa438, 0xd1c1, 0xa438, 0x1800, 0xa438, 0x8057, 0xa438, 0xd07b, + 0xa438, 0xd1c5, 0xa438, 0xd503, 0xa438, 0xa108, 0xa438, 0xd505, + 0xa438, 0x8103, 0xa438, 0xd504, 0xa438, 0xa002, 0xa438, 0xa302, + 0xa438, 0xd707, 0xa438, 0x4061, 0xa438, 0xd503, 0xa438, 0x8b01, + 0xa438, 0xd500, 0xa438, 0xc48a, 0xa438, 0xd503, 0xa438, 0xcc09, + 0xa438, 0xcd58, 0xa438, 0xaf01, 0xa438, 0xd500, 0xa438, 0xbe10, + 0xa438, 0x1000, 0xa438, 0x1739, 0xa438, 0xd719, 0xa438, 0x606c, + 0xa438, 0xd704, 0xa438, 0x645c, 0xa438, 0xd75e, 0xa438, 0x604d, + 0xa438, 0xfff8, 0xa438, 0x9e10, 0xa438, 0x1000, 0xa438, 0x1739, + 0xa438, 0xd719, 0xa438, 0x606c, 0xa438, 0xd704, 0xa438, 0x631c, + 0xa438, 0xd75e, 0xa438, 0x404d, 0xa438, 0xfff8, 0xa438, 0xd504, + 0xa438, 0xaa18, 0xa438, 0xa001, 0xa438, 0xa1e0, 0xa438, 0xd500, + 0xa438, 0x1000, 0xa438, 0x1739, 0xa438, 0xd719, 0xa438, 0x7fac, + 0xa438, 0xd504, 0xa438, 0xa001, 0xa438, 0xd500, 0xa438, 0x1000, + 0xa438, 0x1739, 0xa438, 0xd704, 0xa438, 0x5f5c, 0xa438, 0xd719, + 0xa438, 0x3aaf, 0xa438, 0x8091, 0xa438, 0xf016, 0xa438, 0xd707, + 0xa438, 0x6121, 0xa438, 0x1000, 0xa438, 0x16d8, 0xa438, 0xd503, + 0xa438, 0xcd59, 0xa438, 0xaf01, 0xa438, 0xd500, 0xa438, 0x1800, + 0xa438, 0x0ddc, 0xa438, 0xd503, 0xa438, 0x8040, 0xa438, 0xd500, + 0xa438, 0x1000, 0xa438, 0x16d8, 0xa438, 0xd503, 0xa438, 0xcd5a, + 0xa438, 0xaf01, 0xa438, 0xd500, 0xa438, 0x1800, 0xa438, 0x0dbf, + 0xa438, 0xd504, 0xa438, 0xa008, 0xa438, 0xa204, 0xa438, 0xd500, + 0xa438, 0x1000, 0xa438, 0x1739, 0xa438, 0xd701, 0xa438, 0x5fa0, + 0xa438, 0xd503, 0xa438, 0xa082, 0xa438, 0xd500, 0xa438, 0xd71e, + 0xa438, 0x4097, 0xa438, 0xd078, 0xa438, 0xd1aa, 0xa438, 0xf003, + 0xa438, 0xd078, 0xa438, 0xd1aa, 0xa438, 0xd707, 0xa438, 0x40c1, + 0xa438, 0xd706, 0xa438, 0x409c, 0xa438, 0xd70a, 0xa438, 0x4055, + 0xa438, 0xf010, 0xa438, 0xd706, 0xa438, 0x6065, 0xa438, 0xcc89, + 0xa438, 0xf002, 0xa438, 0xcc8b, 0xa438, 0x1000, 0xa438, 0x0b7b, + 0xa438, 0xd705, 0xa438, 0x2ad0, 0xa438, 0x80ca, 0xa438, 0xf003, + 0xa438, 0x1000, 0xa438, 0x0b81, 0xa438, 0x1000, 0xa438, 0x0b87, + 0xa438, 0x1000, 0xa438, 0x0c53, 0xa438, 0x1800, 0xa438, 0x12d7, + 0xa436, 0xA026, 0xa438, 0x125d, 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, 0xff00, 0xa436, 0xA016, 0xa438, 0x0000, + 0xa436, 0xA012, 0xa438, 0x0ff8, 0xa436, 0xA014, 0xa438, 0xd04d, 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, 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, 0x8022, + 0xa438, 0x1800, 0xa438, 0x8233, 0xa438, 0x1800, 0xa438, 0x8332, + 0xa438, 0x1800, 0xa438, 0x855f, 0xa438, 0x1800, 0xa438, 0x8619, + 0xa438, 0x1800, 0xa438, 0x86af, 0xa438, 0xd706, 0xa438, 0x60a9, + 0xa438, 0xd700, 0xa438, 0x60a1, 0xa438, 0x1800, 0xa438, 0x0962, + 0xa438, 0x1800, 0xa438, 0x0962, 0xa438, 0x1800, 0xa438, 0x0982, + 0xa438, 0x800a, 0xa438, 0x0c1f, 0xa438, 0x0d00, 0xa438, 0x8dc0, + 0xa438, 0x1000, 0xa438, 0x12b5, 0xa438, 0x1800, 0xa438, 0x0f99, + 0xa438, 0xd702, 0xa438, 0x6201, 0xa438, 0xd702, 0xa438, 0x40a0, + 0xa438, 0xd70d, 0xa438, 0x419d, 0xa438, 0x1800, 0xa438, 0x802c, + 0xa438, 0xd701, 0xa438, 0x611a, 0xa438, 0x8710, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0x8280, 0xa438, 0x8780, 0xa438, 0x9503, 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, 0xcb81, 0xa438, 0xd70c, 0xa438, 0x48e2, 0xa438, 0xd706, + 0xa438, 0x407a, 0xa438, 0xd70c, 0xa438, 0x4867, 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, 0x42da, 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, 0x1800, 0xa438, 0x8087, 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, 0x6067, 0xa438, 0x1800, 0xa438, 0x8087, 0xa438, 0x1800, + 0xa438, 0x8092, 0xa438, 0xd403, 0xa438, 0x1000, 0xa438, 0x1203, + 0xa438, 0xcb82, 0xa438, 0xd40a, 0xa438, 0x1000, 0xa438, 0x1203, + 0xa438, 0xd70c, 0xa438, 0x4267, 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, 0x1800, 0xa438, 0x81b7, + 0xa438, 0xd702, 0xa438, 0x6161, 0xa438, 0xd702, 0xa438, 0x40a0, + 0xa438, 0xd70d, 0xa438, 0x40fd, 0xa438, 0x1800, 0xa438, 0x80b0, + 0xa438, 0xd701, 0xa438, 0x607a, 0xa438, 0x1800, 0xa438, 0x80b0, + 0xa438, 0x1800, 0xa438, 0x81a6, 0xa438, 0xa210, 0xa438, 0x8a10, + 0xa438, 0xd706, 0xa438, 0x643e, 0xa438, 0x0c1f, 0xa438, 0x0d04, + 0xa438, 0x8dc0, 0xa438, 0x1000, 0xa438, 0x12b5, 0xa438, 0x0cc0, + 0xa438, 0x0040, 0xa438, 0x0c03, 0xa438, 0x0102, 0xa438, 0x0ce0, + 0xa438, 0x03e0, 0xa438, 0xccce, 0xa438, 0xa00a, 0xa438, 0xa280, + 0xa438, 0xd110, 0xa438, 0xd04c, 0xa438, 0xcba0, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0x8710, + 0xa438, 0xaa0f, 0xa438, 0xa130, 0xa438, 0xaa2f, 0xa438, 0xa2d5, + 0xa438, 0xa405, 0xa438, 0xa720, 0xa438, 0xa00a, 0xa438, 0xcba1, + 0xa438, 0x1800, 0xa438, 0x80fa, 0xa438, 0xd704, 0xa438, 0x3cf1, + 0xa438, 0x80db, 0xa438, 0x0c1f, 0xa438, 0x0d02, 0xa438, 0x1800, + 0xa438, 0x80dd, 0xa438, 0x0c1f, 0xa438, 0x0d01, 0xa438, 0x0cc0, + 0xa438, 0x0d40, 0xa438, 0x1000, 0xa438, 0x12b5, 0xa438, 0x8710, + 0xa438, 0x1000, 0xa438, 0x120e, 0xa438, 0xa108, 0xa438, 0x1000, + 0xa438, 0x1220, 0xa438, 0x8108, 0xa438, 0xa203, 0xa438, 0x8a2f, + 0xa438, 0xa130, 0xa438, 0x8204, 0xa438, 0xa140, 0xa438, 0x1000, + 0xa438, 0x1220, 0xa438, 0x8140, 0xa438, 0x1000, 0xa438, 0x1217, + 0xa438, 0xcba2, 0xa438, 0xd17a, 0xa438, 0xd04b, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xa204, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fa7, + 0xa438, 0xb920, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, + 0xa438, 0x7fb4, 0xa438, 0x9920, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd71f, 0xa438, 0x6145, 0xa438, 0x6074, 0xa438, 0x1800, + 0xa438, 0x8104, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, + 0xa438, 0x5fa7, 0xa438, 0x1800, 0xa438, 0x80fe, 0xa438, 0xb820, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, 0xa438, 0x7fa5, + 0xa438, 0x9820, 0xa438, 0x9b01, 0xa438, 0xd402, 0xa438, 0x1000, + 0xa438, 0x1203, 0xa438, 0xd701, 0xa438, 0x33b1, 0xa438, 0x8124, + 0xa438, 0xd701, 0xa438, 0x60b5, 0xa438, 0xd706, 0xa438, 0x6069, + 0xa438, 0x1800, 0xa438, 0x8126, 0xa438, 0x1800, 0xa438, 0x8196, + 0xa438, 0xd70c, 0xa438, 0x40ab, 0xa438, 0x800a, 0xa438, 0x8110, + 0xa438, 0x8284, 0xa438, 0x8404, 0xa438, 0xa710, 0xa438, 0x8120, + 0xa438, 0x8241, 0xa438, 0x1000, 0xa438, 0x120e, 0xa438, 0xa104, + 0xa438, 0x1000, 0xa438, 0x1220, 0xa438, 0x8104, 0xa438, 0x1000, + 0xa438, 0x1217, 0xa438, 0xaa2f, 0xa438, 0xcba3, 0xa438, 0xd70c, + 0xa438, 0x438b, 0xa438, 0xa284, 0xa438, 0xd078, 0xa438, 0x800a, + 0xa438, 0x8110, 0xa438, 0xa284, 0xa438, 0x8404, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0xa108, 0xa438, 0x9503, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0x0c1f, 0xa438, 0x0f19, 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, 0x0c1f, 0xa438, 0x0d07, 0xa438, 0x8dc0, 0xa438, 0x1000, + 0xa438, 0x12b5, 0xa438, 0x8110, 0xa438, 0xa284, 0xa438, 0xa404, + 0xa438, 0xa00a, 0xa438, 0xcba4, 0xa438, 0xd70c, 0xa438, 0x40a1, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xad10, 0xa438, 0x9503, + 0xa438, 0xd70c, 0xa438, 0x414b, 0xa438, 0x0cc0, 0xa438, 0x0080, + 0xa438, 0x0c03, 0xa438, 0x0102, 0xa438, 0x0ce0, 0xa438, 0x0340, + 0xa438, 0xcc52, 0xa438, 0x1800, 0xa438, 0x8175, 0xa438, 0x80c0, + 0xa438, 0x8103, 0xa438, 0x83e0, 0xa438, 0x8cff, 0xa438, 0x60ba, + 0xa438, 0xd110, 0xa438, 0xd041, 0xa438, 0x1800, 0xa438, 0x817c, + 0xa438, 0xd193, 0xa438, 0xd047, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xa110, 0xa438, 0xcba5, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5faa, + 0xa438, 0xa180, 0xa438, 0xd700, 0xa438, 0x6041, 0xa438, 0xa402, + 0xa438, 0xcba6, 0xa438, 0x60ba, 0xa438, 0xd1f5, 0xa438, 0xd045, + 0xa438, 0x1800, 0xa438, 0x8192, 0xa438, 0xd1f5, 0xa438, 0xd049, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fb4, + 0xa438, 0x8710, 0xa438, 0xa00a, 0xa438, 0xa190, 0xa438, 0xa204, + 0xa438, 0xa280, 0xa438, 0xa404, 0xa438, 0xcba7, 0xa438, 0xbb80, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, 0xa438, 0x5fb4, + 0xa438, 0xb920, 0xa438, 0x9b80, 0xa438, 0x1800, 0xa438, 0x81e5, 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, 0x3559, 0xa438, 0x81c2, 0xa438, 0x1800, 0xa438, 0x81bb, + 0xa438, 0xd700, 0xa438, 0x604b, 0xa438, 0xcb8a, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x3659, 0xa438, 0x81cc, + 0xa438, 0x1800, 0xa438, 0x81c5, 0xa438, 0xd700, 0xa438, 0x606b, + 0xa438, 0xcb8b, 0xa438, 0x5ecb, 0xa438, 0xd700, 0xa438, 0x6041, + 0xa438, 0xa402, 0xa438, 0xcb8c, 0xa438, 0xd706, 0xa438, 0x60ba, + 0xa438, 0xd179, 0xa438, 0xd049, 0xa438, 0x1800, 0xa438, 0x81dc, + 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, 0x6145, + 0xa438, 0x6074, 0xa438, 0x1800, 0xa438, 0x81ea, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd700, 0xa438, 0x5fab, 0xa438, 0x1800, + 0xa438, 0x81e4, 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, 0x60fa, 0xa438, 0xd700, 0xa438, 0x60e1, + 0xa438, 0xd1c8, 0xa438, 0xd045, 0xa438, 0x1800, 0xa438, 0x8218, 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, 0xcc29, 0xa438, 0xa208, 0xa438, 0x8204, 0xa438, 0xd704, + 0xa438, 0x40f5, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xa280, + 0xa438, 0x8780, 0xa438, 0x9503, 0xa438, 0x8e04, 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, 0x1203, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0x1000, 0xa438, 0x1289, 0xa438, 0xd700, 0xa438, 0x5f7a, + 0xa438, 0xd704, 0xa438, 0x5f36, 0xa438, 0xd706, 0xa438, 0x6089, + 0xa438, 0xd40c, 0xa438, 0x1000, 0xa438, 0x1203, 0xa438, 0xaa40, + 0xa438, 0xbb10, 0xa438, 0xcb50, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xa310, 0xa438, 0x9503, 0xa438, 0xcb5f, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0x1000, 0xa438, 0x1289, 0xa438, 0xd71f, + 0xa438, 0x5f75, 0xa438, 0x8190, 0xa438, 0x82a0, 0xa438, 0x8402, + 0xa438, 0xa404, 0xa438, 0x800a, 0xa438, 0x8718, 0xa438, 0x9b10, + 0xa438, 0x9b20, 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd71f, + 0xa438, 0x7fb5, 0xa438, 0xcb51, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd71f, 0xa438, 0x5f94, 0xa438, 0xd706, 0xa438, 0x61a9, + 0xa438, 0xd702, 0xa438, 0x40a1, 0xa438, 0xd706, 0xa438, 0x4079, + 0xa438, 0xd706, 0xa438, 0x609d, 0xa438, 0xd141, 0xa438, 0xd043, + 0xa438, 0xf006, 0xa438, 0xd101, 0xa438, 0xd040, 0xa438, 0xf003, + 0xa438, 0xd141, 0xa438, 0xd044, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xd700, 0xa438, 0x60e5, + 0xa438, 0xd704, 0xa438, 0x60be, 0xa438, 0xd706, 0xa438, 0x29b1, + 0xa438, 0x8280, 0xa438, 0xf002, 0xa438, 0xa880, 0xa438, 0xa00a, + 0xa438, 0xa190, 0xa438, 0x8220, 0xa438, 0xa280, 0xa438, 0xa404, + 0xa438, 0xa620, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xc5aa, + 0xa438, 0x9503, 0xa438, 0xd700, 0xa438, 0x6061, 0xa438, 0xa402, + 0xa438, 0xa480, 0xa438, 0xcb52, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x5fba, 0xa438, 0xd704, 0xa438, 0x5f76, + 0xa438, 0xb920, 0xa438, 0xcb53, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd71f, 0xa438, 0x7fb4, 0xa438, 0x9920, 0xa438, 0xa00a, + 0xa438, 0xa190, 0xa438, 0xa280, 0xa438, 0x8220, 0xa438, 0xa404, + 0xa438, 0xb580, 0xa438, 0xd700, 0xa438, 0x40a1, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0xa602, 0xa438, 0x9503, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0xa310, 0xa438, 0x9503, 0xa438, 0xcb60, + 0xa438, 0xd101, 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x126b, + 0xa438, 0xd700, 0xa438, 0x5fb4, 0xa438, 0xaa10, 0xa438, 0xd70c, + 0xa438, 0x2833, 0xa438, 0x82b9, 0xa438, 0xf003, 0xa438, 0x1000, + 0xa438, 0x1330, 0xa438, 0xd70c, 0xa438, 0x40a6, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0xa140, 0xa438, 0x9503, 0xa438, 0xd70c, + 0xa438, 0x40a3, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xac20, + 0xa438, 0x9503, 0xa438, 0xa90c, 0xa438, 0xaa80, 0xa438, 0x0c1f, + 0xa438, 0x0d07, 0xa438, 0x8dc0, 0xa438, 0x1000, 0xa438, 0x12b5, + 0xa438, 0xa00a, 0xa438, 0xa190, 0xa438, 0xa280, 0xa438, 0x8220, + 0xa438, 0xa404, 0xa438, 0xb580, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xc500, 0xa438, 0x9503, 0xa438, 0x83e0, 0xa438, 0x8e01, + 0xa438, 0xd700, 0xa438, 0x40a1, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xa602, 0xa438, 0x9503, 0xa438, 0xd14a, 0xa438, 0xd058, + 0xa438, 0x1000, 0xa438, 0x12d7, 0xa438, 0xd70c, 0xa438, 0x4063, + 0xa438, 0x1000, 0xa438, 0x12ea, 0xa438, 0xcb6f, 0xa438, 0x1000, + 0xa438, 0x126b, 0xa438, 0xd704, 0xa438, 0x2e70, 0xa438, 0x8327, + 0xa438, 0xd71f, 0xa438, 0x676e, 0xa438, 0xd704, 0xa438, 0x3868, + 0xa438, 0x8302, 0xa438, 0xd706, 0xa438, 0x61c2, 0xa438, 0xd70c, + 0xa438, 0x2f18, 0xa438, 0x8308, 0xa438, 0xd700, 0xa438, 0x5d35, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xc5aa, 0xa438, 0x9503, + 0xa438, 0x0ce0, 0xa438, 0x0320, 0xa438, 0x1800, 0xa438, 0x830e, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xc5aa, 0xa438, 0x9503, + 0xa438, 0x1800, 0xa438, 0x832e, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0xc5aa, 0xa438, 0x9503, 0xa438, 0x1800, 0xa438, 0x8330, + 0xa438, 0x1000, 0xa438, 0x12d7, 0xa438, 0xae02, 0xa438, 0xd70c, + 0xa438, 0x4063, 0xa438, 0x1000, 0xa438, 0x12ea, 0xa438, 0xcb61, + 0xa438, 0x1000, 0xa438, 0x126b, 0xa438, 0xd704, 0xa438, 0x2e70, + 0xa438, 0x8327, 0xa438, 0xd704, 0xa438, 0x3868, 0xa438, 0x832e, + 0xa438, 0xd706, 0xa438, 0x61e2, 0xa438, 0xd71f, 0xa438, 0x612e, + 0xa438, 0xd70c, 0xa438, 0x2f18, 0xa438, 0x8330, 0xa438, 0x1800, + 0xa438, 0x830e, 0xa438, 0x8e02, 0xa438, 0x1800, 0xa438, 0x0f99, + 0xa438, 0xae04, 0xa438, 0x8310, 0xa438, 0x1800, 0xa438, 0x0e31, + 0xa438, 0x1800, 0xa438, 0x85ac, 0xa438, 0x1800, 0xa438, 0x0e07, 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, 0xa706, 0xa438, 0xd70c, 0xa438, 0x404b, 0xa438, 0xa880, + 0xa438, 0x8801, 0xa438, 0x8e01, 0xa438, 0xca50, 0xa438, 0x1000, + 0xa438, 0x83d5, 0xa438, 0xca51, 0xa438, 0xd70e, 0xa438, 0x2210, + 0xa438, 0x83d3, 0xa438, 0xd70c, 0xa438, 0x4084, 0xa438, 0xd705, + 0xa438, 0x5efd, 0xa438, 0xf007, 0xa438, 0x1000, 0xa438, 0x17c2, + 0xa438, 0xd70c, 0xa438, 0x5ce2, 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, 0x83b5, + 0xa438, 0xba10, 0xa438, 0x0000, 0xa438, 0x0000, 0xa438, 0x1000, + 0xa438, 0x84ae, 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, 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, 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, 0x835a, 0xa438, 0x8804, + 0xa438, 0xa704, 0xa438, 0x8788, 0xa438, 0xff82, 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, 0x8336, 0xa438, 0x1800, 0xa438, 0x147c, 0xa438, 0xd705, + 0xa438, 0x405f, 0xa438, 0xf037, 0xa438, 0xd701, 0xa438, 0x4259, 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, 0xd704, 0xa438, 0x6127, 0xa438, 0x2951, 0xa438, 0x83ec, 0xa438, 0xd70c, 0xa438, 0x4083, 0xa438, 0xd70c, 0xa438, 0x2e81, - 0xa438, 0x81cb, 0xa438, 0xf0c5, 0xa438, 0x80fe, 0xa438, 0x8610, + 0xa438, 0x83ec, 0xa438, 0xf0c2, 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, 0xac02, 0xa438, 0xa502, 0xa438, 0x8980, 0xa438, 0xca60, + 0xa438, 0xa004, 0xa438, 0xd70c, 0xa438, 0x6065, 0xa438, 0x1800, + 0xa438, 0x83fc, 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, 0xf0a0, + 0xa438, 0xd704, 0xa438, 0x63ab, 0xa438, 0xd705, 0xa438, 0x4371, + 0xa438, 0xd702, 0xa438, 0x339c, 0xa438, 0x84ad, 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, 0xf082, 0xa438, 0xd70c, 0xa438, 0x60c5, + 0xa438, 0xd702, 0xa438, 0x6053, 0xa438, 0xf07d, 0xa438, 0x1800, + 0xa438, 0x84aa, 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, 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, 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, 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, 0x8240, 0xa438, 0xd702, 0xa438, 0x6898, 0xa438, 0xd702, + 0xa438, 0x4957, 0xa438, 0x1800, 0xa438, 0x849c, 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, 0xfec8, 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, 0x84be, 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, 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, 0x17e8, 0xa438, 0xd70c, 0xa438, 0x5f3c, + 0xa438, 0xd702, 0xa438, 0x3bd0, 0xa438, 0x84fc, 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, 0x852f, 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, 0x855e, 0xa438, 0xff5b, + 0xa438, 0x0cfc, 0xa438, 0x0390, 0xa438, 0x0cfc, 0xa438, 0x0590, + 0xa438, 0x0800, 0xa438, 0xd704, 0xa438, 0x60f9, 0xa438, 0xd704, + 0xa438, 0x6958, 0xa438, 0xd706, 0xa438, 0x6902, 0xa438, 0x1800, + 0xa438, 0x1001, 0xa438, 0xa220, 0xa438, 0xa404, 0xa438, 0xd704, + 0xa438, 0x4054, 0xa438, 0xa740, 0xa438, 0xa504, 0xa438, 0xd704, + 0xa438, 0x40b5, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0xa003, + 0xa438, 0x9503, 0xa438, 0x8190, 0xa438, 0xcb91, 0xa438, 0x1000, + 0xa438, 0x10af, 0xa438, 0xd704, 0xa438, 0x7fb9, 0xa438, 0x8220, + 0xa438, 0x8404, 0xa438, 0xa280, 0xa438, 0xa110, 0xa438, 0xd706, + 0xa438, 0x4041, 0xa438, 0xa180, 0xa438, 0x1000, 0xa438, 0x130c, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x850f, 0xa438, 0x9503, + 0xa438, 0x0c1f, 0xa438, 0x0d08, 0xa438, 0x0cc0, 0xa438, 0x0d80, + 0xa438, 0x1000, 0xa438, 0x12b5, 0xa438, 0x1000, 0xa438, 0x10af, + 0xa438, 0xd704, 0xa438, 0x615f, 0xa438, 0xd70c, 0xa438, 0x6103, + 0xa438, 0x8504, 0xa438, 0xd704, 0xa438, 0x40b5, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0x8003, 0xa438, 0x9503, 0xa438, 0xcb92, + 0xa438, 0x1000, 0xa438, 0x10af, 0xa438, 0xd706, 0xa438, 0x7fa3, + 0xa438, 0x8280, 0xa438, 0x8190, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0x0c0f, 0xa438, 0x050a, 0xa438, 0x9503, 0xa438, 0x0c1f, + 0xa438, 0x0d00, 0xa438, 0x8dc0, 0xa438, 0x1000, 0xa438, 0x12b5, + 0xa438, 0x1800, 0xa438, 0x1001, 0xa438, 0x0c1f, 0xa438, 0x0d00, + 0xa438, 0x8dc0, 0xa438, 0x1000, 0xa438, 0x12b5, 0xa438, 0x800a, + 0xa438, 0xd705, 0xa438, 0x40b9, 0xa438, 0xd70c, 0xa438, 0x6063, + 0xa438, 0xa020, 0xa438, 0xf003, 0xa438, 0xd705, 0xa438, 0x8020, + 0xa438, 0xa504, 0xa438, 0xd704, 0xa438, 0x40b5, 0xa438, 0x0c03, + 0xa438, 0x1502, 0xa438, 0xa003, 0xa438, 0x9503, 0xa438, 0xd704, + 0xa438, 0x4054, 0xa438, 0xa740, 0xa438, 0x8190, 0xa438, 0xcb93, + 0xa438, 0xd700, 0xa438, 0x6063, 0xa438, 0xd704, 0xa438, 0x609c, + 0xa438, 0xd14b, 0xa438, 0xd040, 0xa438, 0xf003, 0xa438, 0xd120, + 0xa438, 0xd040, 0xa438, 0x1000, 0xa438, 0x10af, 0xa438, 0xd700, + 0xa438, 0x5fb4, 0xa438, 0xa008, 0xa438, 0xd706, 0xa438, 0x4040, + 0xa438, 0xa002, 0xa438, 0xd705, 0xa438, 0x4079, 0xa438, 0x1000, + 0xa438, 0x1313, 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x85f0, + 0xa438, 0x9503, 0xa438, 0xd705, 0xa438, 0x40d9, 0xa438, 0xd70c, + 0xa438, 0x6083, 0xa438, 0x0c1f, 0xa438, 0x0d09, 0xa438, 0xf003, + 0xa438, 0x0c1f, 0xa438, 0x0d0a, 0xa438, 0x0cc0, 0xa438, 0x0d80, + 0xa438, 0x1000, 0xa438, 0x12b5, 0xa438, 0x1000, 0xa438, 0x10af, + 0xa438, 0x8020, 0xa438, 0xd705, 0xa438, 0x4199, 0xa438, 0xd704, + 0xa438, 0x615f, 0xa438, 0xd70c, 0xa438, 0x6103, 0xa438, 0x8504, + 0xa438, 0xd704, 0xa438, 0x40b5, 0xa438, 0x0c03, 0xa438, 0x1502, + 0xa438, 0x8003, 0xa438, 0x9503, 0xa438, 0xcb94, 0xa438, 0x1000, + 0xa438, 0x10af, 0xa438, 0xd706, 0xa438, 0x7fa2, 0xa438, 0x800a, + 0xa438, 0x0c03, 0xa438, 0x1502, 0xa438, 0x85f0, 0xa438, 0x9503, + 0xa438, 0xd705, 0xa438, 0x40b9, 0xa438, 0x0c1f, 0xa438, 0x0d00, + 0xa438, 0x8dc0, 0xa438, 0xf005, 0xa438, 0x0c1f, 0xa438, 0x0d07, + 0xa438, 0x8dc0, 0xa438, 0xa190, 0xa438, 0x1000, 0xa438, 0x12b5, + 0xa438, 0xd705, 0xa438, 0x39cc, 0xa438, 0x8617, 0xa438, 0x1800, + 0xa438, 0x1001, 0xa438, 0x1800, 0xa438, 0x82c7, 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, 0x8629, 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, 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, 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, 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, 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, 0x8671, + 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, 0x86b3, 0xa438, 0x1800, 0xa438, 0x001a, 0xa438, 0x1800, + 0xa438, 0x12cb, 0xa436, 0xA10E, 0xa438, 0x12cf, 0xa436, 0xA10C, + 0xa438, 0x04f8, 0xa436, 0xA10A, 0xa438, 0x1003, 0xa436, 0xA108, + 0xa438, 0x15fb, 0xa436, 0xA106, 0xa438, 0x0d2b, 0xa436, 0xA104, + 0xa438, 0x0ecb, 0xa436, 0xA102, 0xa438, 0x1119, 0xa436, 0xA100, + 0xa438, 0x0960, 0xa436, 0xA110, 0xa438, 0x00ff, 0xa436, 0xA016, + 0xa438, 0x0020, 0xa436, 0xA012, 0xa438, 0x1ff8, 0xa436, 0xA014, + 0xa438, 0xa704, 0xa438, 0x82c7, 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, 0xA164, 0xa438, 0x119F, 0xa436, 0xA166, 0xa438, 0x11A1, + 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, 0x0003, 0xa436, 0xb87c, 0xa438, 0x8a63, + 0xa436, 0xb87e, 0xa438, 0xaf8a, 0xa438, 0x7baf, 0xa438, 0x8ab6, + 0xa438, 0xaf8a, 0xa438, 0xd6af, 0xa438, 0x8ae4, 0xa438, 0xaf8a, + 0xa438, 0xf2af, 0xa438, 0x8b01, 0xa438, 0xaf8b, 0xa438, 0x0aaf, + 0xa438, 0x8b10, 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, 0x86a5, 0xa438, 0xad25, 0xa438, 0x0602, + 0xa438, 0x6ba4, 0xa438, 0x0265, 0xa438, 0x4faf, 0xa438, 0x6e9a, + 0xa438, 0xac24, 0xa438, 0x03af, 0xa438, 0x6bb4, 0xa438, 0xaf6b, + 0xa438, 0xb602, 0xa438, 0x7ae8, 0xa438, 0xaf6c, 0xa438, 0xa100, 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, + 0xa436, 0xb886, 0xa438, 0x6E7C, 0xa436, 0xb888, 0xa438, 0x6BAE, + 0xa436, 0xb88a, 0xa438, 0x6C9B, 0xa436, 0xb88c, 0xa438, 0xffff, + 0xa436, 0xb838, 0xa438, 0x007f, 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, @@ -10663,11 +11278,8 @@ rtl8126_hw_phy_config_8126a_1(struct net_device *dev) rtl8126_set_eth_phy_ocp_bit(tp, 0xA442, BIT_11); - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8126_enable_phy_aldps(tp); - } - } + if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) + rtl8126_enable_phy_aldps(tp); } static void @@ -11137,11 +11749,8 @@ rtl8126_hw_phy_config_8126a_2(struct net_device *dev) 0x3700); - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8126_enable_phy_aldps(tp); - } - } + if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) + rtl8126_enable_phy_aldps(tp); } static void @@ -11378,17 +11987,33 @@ rtl8126_hw_phy_config_8126a_3(struct net_device *dev) 0x3700); - if (aspm) { - if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { - rtl8126_enable_phy_aldps(tp); - } - } + rtl8126_set_eth_phy_ocp_bit(tp, 0xB648, BIT_6); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x8082); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x5D00); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x807C); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x5000); + rtl8126_mdio_direct_write_phy_ocp(tp, 0xB87C, 0x809D); + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + 0xB87E, + 0xFF00, + 0x5000); + + + if (aspm && HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) + rtl8126_enable_phy_aldps(tp); } static void rtl8126_hw_phy_config(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; if (tp->resume_not_chg_speed) return; @@ -11398,6 +12023,8 @@ rtl8126_hw_phy_config(struct net_device *dev) if (HW_DASH_SUPPORT_TYPE_3(tp) && tp->HwPkgDet == 0x06) return; + spin_lock_irqsave(&tp->phy_lock, flags); + #ifndef ENABLE_USE_FIRMWARE_FILE if (!tp->rtl_fw) rtl8126_init_hw_phy_mcu(dev); @@ -11425,6 +12052,11 @@ rtl8126_hw_phy_config(struct net_device *dev) break; } +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(tp)) + rtl8126_hw_fiber_phy_config(tp); +#endif /* ENABLE_FIBER_SUPPORT */ + rtl8126_mdio_write(tp, 0x1F, 0x0000); if (HW_HAS_WRITE_PHY_MCU_RAM_CODE(tp)) { @@ -11433,6 +12065,8 @@ rtl8126_hw_phy_config(struct net_device *dev) else rtl8126_disable_eee(tp); } + + spin_unlock_irqrestore(&tp->phy_lock, flags); } static void @@ -11565,9 +12199,8 @@ rtl8126_setup_mqs_reg(struct rtl8126_private *tp) //tx tp->tx_ring[0].tdsar_reg = TxDescStartAddrLow; - for (i = 1; i < R8126_MAX_TX_QUEUES; i++) { + for (i = 1; i < tp->HwSuppNumTxQueues; i++) tp->tx_ring[i].tdsar_reg = (u16)(TNPDS_Q1_LOW_8125 + (i - 1) * 8); - } switch (tp->HwSuppTxNoCloseVer) { case 4: @@ -11588,26 +12221,23 @@ rtl8126_setup_mqs_reg(struct rtl8126_private *tp) break; } - for (i = 0; i < R8126_MAX_TX_QUEUES; i++) { + for (i = 0; i < tp->HwSuppNumTxQueues; 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 < R8126_MAX_RX_QUEUES; i++) { + for (i = 1; i < tp->HwSuppNumRxQueues; 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 < R8126_MAX_QUEUES; i++) { + for (i = 1; i < tp->hw_supp_irq_nvecs; i++) tp->isr_reg[i] = (u16)(ISR1_8125 + (i - 1) * 4); - } tp->imr_reg[0] = IMR0_8125; - for (i = 1; i < R8126_MAX_QUEUES; i++) { + for (i = 1; i < tp->hw_supp_irq_nvecs; i++) tp->imr_reg[i] = (u16)(IMR1_8125 + (i - 1) * 4); - } } static void @@ -11687,11 +12317,10 @@ rtl8126_init_software_variable(struct net_device *dev) #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) } - if (cmac_ioaddr == NULL) { + if (cmac_ioaddr == NULL) tp->DASH = 0; - } else { + else tp->mapped_cmac_ioaddr = cmac_ioaddr; - } } eee_enable = 0; @@ -11754,6 +12383,10 @@ rtl8126_init_software_variable(struct net_device *dev) break; } +#ifdef ENABLE_FIBER_SUPPORT + rtl8126_check_fiber_mode_support(tp); +#endif /* ENABLE_FIBER_SUPPORT */ + switch (tp->mcfg) { case CFG_METHOD_1: case CFG_METHOD_2: @@ -11864,11 +12497,6 @@ rtl8126_init_software_variable(struct net_device *dev) break; } -#ifdef ENABLE_PTP_SUPPORT - if (tp->HwSuppPtpVer > 0) - tp->EnablePtp = 1; -#endif - //init interrupt switch (tp->mcfg) { case CFG_METHOD_1: @@ -11937,6 +12565,18 @@ rtl8126_init_software_variable(struct net_device *dev) rtl8126_set_ring_size(tp, NUM_RX_DESC, NUM_TX_DESC); + switch (tp->mcfg) { + case CFG_METHOD_1: + case CFG_METHOD_2: + case CFG_METHOD_3: + tp->HwSuppPtpVer = 2; + break; + } +#ifdef ENABLE_PTP_SUPPORT + if (tp->HwSuppPtpVer > 0) + tp->EnablePtp = 1; +#endif + switch (tp->mcfg) { case CFG_METHOD_1: tp->HwSuppIntMitiVer = 4; @@ -11970,17 +12610,41 @@ rtl8126_init_software_variable(struct net_device *dev) timer_count_v2 = (timer_count / 0x100); - tp->InitRxDescType = RX_DESC_RING_TYPE_1; - if (tp->EnableRss || tp->EnablePtp) - tp->InitRxDescType = RX_DESC_RING_TYPE_3; + switch (tp->mcfg) { + case CFG_METHOD_1: + tp->HwSuppRxDescType = RX_DESC_RING_TYPE_3; + break; + case CFG_METHOD_2: + case CFG_METHOD_3: + tp->HwSuppRxDescType = RX_DESC_RING_TYPE_4; + break; + default: + tp->HwSuppRxDescType = RX_DESC_RING_TYPE_1; + break; + } + tp->InitRxDescType = RX_DESC_RING_TYPE_1; tp->RxDescLength = RX_DESC_LEN_TYPE_1; - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - tp->RxDescLength = RX_DESC_LEN_TYPE_3; + switch (tp->HwSuppRxDescType) { + case RX_DESC_RING_TYPE_3: + if (tp->EnableRss) { + tp->InitRxDescType = RX_DESC_RING_TYPE_3; + tp->RxDescLength = RX_DESC_LEN_TYPE_3; + } + break; + case RX_DESC_RING_TYPE_4: + if (tp->EnableRss) { + tp->InitRxDescType = RX_DESC_RING_TYPE_4; + tp->RxDescLength = RX_DESC_LEN_TYPE_4; + } + break; + } tp->rtl8126_rx_config = rtl_chip_info[tp->chipset].RCR_Cfg; if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) tp->rtl8126_rx_config |= EnableRxDescV3; + else if (tp->InitRxDescType == RX_DESC_RING_TYPE_4) + tp->rtl8126_rx_config &= ~EnableRxDescV4_1; tp->NicCustLedValue = RTL_R16(tp, CustomLED); @@ -11998,20 +12662,25 @@ rtl8126_init_software_variable(struct net_device *dev) #endif //LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) if (tp->mcfg != CFG_METHOD_DEFAULT) { - struct ethtool_eee *eee = &tp->eee; + struct ethtool_keee *eee = &tp->eee; eee->eee_enabled = eee_enable; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) eee->supported = SUPPORTED_100baseT_Full | - SUPPORTED_1000baseT_Full; + SUPPORTED_1000baseT_Full | + SUPPORTED_2500baseX_Full; eee->advertised = mmd_eee_adv_to_ethtool_adv_t(MDIO_EEE_1000T | MDIO_EEE_100TX); - switch (tp->mcfg) { - default: - if (HW_SUPP_PHY_LINK_SPEED_2500M(tp)) { - eee->supported |= SUPPORTED_2500baseX_Full; - eee->advertised |= SUPPORTED_2500baseX_Full; - } - break; - } + eee->advertised |= SUPPORTED_2500baseX_Full; +#else + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, eee->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, eee->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, eee->advertised); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, eee->advertised); + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, eee->advertised); + linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, eee->advertised); +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) */ eee->tx_lpi_enabled = eee_enable; eee->tx_lpi_timer = dev->mtu + ETH_HLEN + 0x20; } @@ -12960,10 +13629,13 @@ static void rtl8126_phy_power_up(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; if (rtl8126_is_in_phy_disable_mode(dev)) return; + spin_lock_irqsave(&tp->phy_lock, flags); + rtl8126_mdio_write(tp, 0x1F, 0x0000); rtl8126_mdio_write(tp, MII_BMCR, BMCR_ANENABLE); @@ -12975,15 +13647,25 @@ rtl8126_phy_power_up(struct net_device *dev) rtl8126_wait_phy_ups_resume(dev, 3); break; }; + + spin_unlock_irqrestore(&tp->phy_lock, flags); } static void rtl8126_phy_power_down(struct net_device *dev) { struct rtl8126_private *tp = netdev_priv(dev); + unsigned long flags; +#ifdef ENABLE_FIBER_SUPPORT + if (HW_FIBER_MODE_ENABLED(tp)) + return; +#endif /* ENABLE_FIBER_SUPPORT */ + + spin_lock_irqsave(&tp->phy_lock, flags); rtl8126_mdio_write(tp, 0x1F, 0x0000); rtl8126_mdio_write(tp, MII_BMCR, BMCR_ANENABLE | BMCR_PDOWN); + spin_unlock_irqrestore(&tp->phy_lock, flags); } static int __devinit @@ -13046,9 +13728,8 @@ rtl8126_init_board(struct pci_dev *pdev, pci_read_config_word(pdev, pm_cap + PCI_PM_CTRL, &pwr_command); } else { #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) - if (netif_msg_probe(tp)) { + if (netif_msg_probe(tp)) dev_err(&pdev->dev, "PowerManagement capability not found.\n"); - } #else printk("PowerManagement capability not found.\n"); #endif //LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) @@ -13354,8 +14035,32 @@ rtl8126_link_timer(struct timer_list *t) } */ -int -rtl8126_enable_msix(struct rtl8126_private *tp) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) +static int pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, + int minvec, int maxvec) +{ + int nvec = maxvec; + int rc; + + if (maxvec < minvec) + return -ERANGE; + + do { + rc = pci_enable_msix(dev, entries, nvec); + if (rc < 0) { + return rc; + } else if (rc > 0) { + if (rc < minvec) + return -ENOSPC; + nvec = rc; + } + } while (rc); + + return nvec; +} +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */ + +static int rtl8126_enable_msix(struct rtl8126_private *tp) { int i, nvecs = 0; struct msix_entry msix_ent[R8126_MAX_MSIX_VEC]; @@ -13402,9 +14107,6 @@ static int rtl8126_try_msi(struct rtl8126_private *tp) tp->hw_supp_irq_nvecs = clamp_val(hw_supp_irq_nvecs, 1, 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_1: case CFG_METHOD_2: @@ -13412,7 +14114,13 @@ static int rtl8126_try_msi(struct rtl8126_private *tp) tp->max_irq_nvecs = tp->hw_supp_irq_nvecs; tp->min_irq_nvecs = R8126_MIN_MSIX_VEC_8125B; break; + default: + tp->max_irq_nvecs = 1; + tp->min_irq_nvecs = 1; + break; } +#ifdef DISABLE_MULTI_MSIX_VECTOR + tp->max_irq_nvecs = 1; #endif #if defined(RTL_USE_NEW_INTR_API) @@ -13485,7 +14193,7 @@ rtl8126_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) stats->tx_errors = le64_to_cpu(counters->tx_errors); stats->collisions = le32_to_cpu(counters->tx_multi_collision); - stats->tx_aborted_errors = le16_to_cpu(counters->tx_aborted) ; + stats->tx_aborted_errors = le16_to_cpu(counters->tx_aborted); stats->rx_missed_errors = le16_to_cpu(counters->rx_missed); } #else @@ -13561,6 +14269,8 @@ static int rtl8126_poll(napi_ptr napi, napi_budget budget) for (i = 0; i < tp->num_rx_rings; i++) work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[i], budget); + work_done = min(work_done, work_to_do); + RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); if (work_done < work_to_do) { @@ -13598,9 +14308,11 @@ static int rtl8126_poll_msix_ring(napi_ptr napi, napi_budget budget) unsigned int work_done = 0; const int message_id = r8126napi->index; - rtl8126_tx_interrupt_with_vector(tp, message_id, budget); + if (message_id < tp->num_tx_rings) + rtl8126_tx_interrupt_with_vector(tp, message_id, budget); - work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); + if (message_id < tp->num_rx_rings) + work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); @@ -13677,6 +14389,7 @@ static int rtl8126_poll_msix_other(napi_ptr napi, napi_budget budget) //suppress unused variable (void)(dev); + (void)(work_to_do); #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) RTL_NETIF_RX_COMPLETE(dev, napi, work_to_do); @@ -13698,7 +14411,8 @@ static int rtl8126_poll_msix_rx(napi_ptr napi, napi_budget budget) unsigned int work_done = 0; const int message_id = r8126napi->index; - work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); + if (message_id < tp->num_rx_rings) + work_done += rtl8126_rx_interrupt(dev, tp, &tp->rx_ring[message_id], budget); RTL_NAPI_QUOTA_UPDATE(dev, work_done, budget); @@ -13817,18 +14531,6 @@ rtl8126_set_real_num_queue(struct rtl8126_private *tp) return retval; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) -void netdev_sw_irq_coalesce_default_on(struct net_device *dev) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) - WARN_ON(dev->reg_state == NETREG_REGISTERED); - - dev->gro_flush_timeout = 20000; - dev->napi_defer_hard_irqs = 1; -#endif //LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0) -} -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) - static int __devinit rtl8126_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -13856,6 +14558,8 @@ rtl8126_init_one(struct pci_dev *pdev, tp = netdev_priv(dev); assert(ioaddr != NULL); + spin_lock_init(&tp->phy_lock); + tp->set_speed = rtl8126_set_speed_xmii; tp->get_settings = rtl8126_gset_xmii; tp->phy_reset_enable = rtl8126_xmii_reset_enable; @@ -14013,7 +14717,9 @@ rtl8126_init_one(struct pci_dev *pdev, netif_carrier_off(dev); +#ifdef ENABLE_R8126_SYSFS rtl8126_sysfs_init(dev); +#endif /* ENABLE_R8126_SYSFS */ printk("%s", GPL_CLAIM); @@ -14364,7 +15070,7 @@ int rtl8126_open(struct net_device *dev) clear_bit(R8126_FLAG_DOWN, tp->task_flags); if (tp->resume_not_chg_speed) - rtl8126_check_link_status(dev); + _rtl8126_check_link_status(dev, R8126_LINK_STATE_UNKNOWN); else rtl8126_set_speed(dev, tp->autoneg, tp->speed, tp->duplex, tp->advertising); @@ -14392,12 +15098,14 @@ static void set_offset70F(struct rtl8126_private *tp, u8 setting) { u32 csi_tmp; - u32 temp = (u32)setting; - temp = temp << 24; + u32 temp; + + temp = setting & 0x3f; + temp <<= 24; /*set PCI configuration space offset 0x70F to setting*/ /*When the register offset of PCI configuration space larger than 0xff, use CSI to access it.*/ - csi_tmp = rtl8126_csi_read(tp, 0x70c) & 0x00ffffff; + csi_tmp = rtl8126_csi_read(tp, 0x70c) & 0xc0ffffff; rtl8126_csi_write(tp, 0x70c, csi_tmp | temp); } @@ -14640,8 +15348,14 @@ rtl8126_hw_config(struct net_device *dev) mac_ocp_data |= (BIT_0); rtl8126_mac_ocp_write(tp, 0xEB58, mac_ocp_data); - if (tp->mcfg == CFG_METHOD_2 || tp->mcfg == CFG_METHOD_3) - RTL_W8(tp, 0xD8, RTL_R8(tp, 0xD8) & ~BIT_1); + if (tp->HwSuppRxDescType == RX_DESC_RING_TYPE_4) { + if (tp->InitRxDescType == RX_DESC_RING_TYPE_4) + RTL_W8(tp, 0xd8, RTL_R8(tp, 0xd8) | + EnableRxDescV4_0); + else + RTL_W8(tp, 0xd8, RTL_R8(tp, 0xd8) & + ~EnableRxDescV4_0); + } mac_ocp_data = rtl8126_mac_ocp_read(tp, 0xE614); mac_ocp_data &= ~(BIT_10 | BIT_9 | BIT_8); @@ -14908,10 +15622,26 @@ rtl8126_set_desc_dma_addr(struct rtl8126_private *tp, struct RxDesc *desc, dma_addr_t mapping) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: ((struct RxDescV3 *)desc)->addr = cpu_to_le64(mapping); - else + break; + case RX_DESC_RING_TYPE_4: + ((struct RxDescV4 *)desc)->addr = cpu_to_le64(mapping); + break; + default: desc->addr = cpu_to_le64(mapping); + break; + } +} + +static inline void +rtl8126_mark_to_asic_v1(struct RxDesc *desc, + u32 rx_buf_sz) +{ + u32 eor = le32_to_cpu(desc->opts1) & RingEnd; + + WRITE_ONCE(desc->opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); } static inline void @@ -14923,17 +15653,30 @@ rtl8126_mark_to_asic_v3(struct RxDescV3 *descv3, WRITE_ONCE(descv3->RxDescNormalDDWord4.opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); } +static inline void +rtl8126_mark_to_asic_v4(struct RxDescV4 *descv4, + u32 rx_buf_sz) +{ + u32 eor = le32_to_cpu(descv4->RxDescNormalDDWord2.opts1) & RingEnd; + + WRITE_ONCE(descv4->RxDescNormalDDWord2.opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); +} + void rtl8126_mark_to_asic(struct rtl8126_private *tp, struct RxDesc *desc, u32 rx_buf_sz) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: rtl8126_mark_to_asic_v3((struct RxDescV3 *)desc, rx_buf_sz); - else { - u32 eor = le32_to_cpu(desc->opts1) & RingEnd; - - WRITE_ONCE(desc->opts1, cpu_to_le32(DescOwn | eor | rx_buf_sz)); + break; + case RX_DESC_RING_TYPE_4: + rtl8126_mark_to_asic_v4((struct RxDescV4 *)desc, rx_buf_sz); + break; + default: + rtl8126_mark_to_asic_v1(desc, rx_buf_sz); + break; } } @@ -15176,20 +15919,39 @@ rtl8126_rx_clear(struct rtl8126_private *tp) } } -static inline void -rtl8126_mark_as_last_descriptor_8125(struct RxDescV3 *descv3) +static void +rtl8126_mark_as_last_descriptor_v1(struct RxDesc *desc) +{ + desc->opts1 |= cpu_to_le32(RingEnd); +} + +static void +rtl8126_mark_as_last_descriptor_v3(struct RxDescV3 *descv3) { descv3->RxDescNormalDDWord4.opts1 |= cpu_to_le32(RingEnd); } -static inline void +static void +rtl8126_mark_as_last_descriptor_v4(struct RxDescV4 *descv4) +{ + descv4->RxDescNormalDDWord2.opts1 |= cpu_to_le32(RingEnd); +} + +void rtl8126_mark_as_last_descriptor(struct rtl8126_private *tp, struct RxDesc *desc) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) - rtl8126_mark_as_last_descriptor_8125((struct RxDescV3 *)desc); - else - desc->opts1 |= cpu_to_le32(RingEnd); + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: + rtl8126_mark_as_last_descriptor_v3((struct RxDescV3 *)desc); + break; + case RX_DESC_RING_TYPE_4: + rtl8126_mark_as_last_descriptor_v4((struct RxDescV4 *)desc); + break; + default: + rtl8126_mark_as_last_descriptor_v1(desc); + break; + } } static void @@ -15528,7 +16290,7 @@ static void rtl8126_reset_task(struct work_struct *work) #endif //CONFIG_R8126_NAPI if (tp->resume_not_chg_speed) { - _rtl8126_check_link_status(dev); + _rtl8126_check_link_status(dev, R8126_LINK_STATE_UNKNOWN); tp->resume_not_chg_speed = 0; } else { @@ -16343,7 +17105,7 @@ rtl8126_tx_interrupt_with_vector(struct rtl8126_private *tp, if (message_id == 16) count += rtl8126_tx_interrupt(&tp->tx_ring[0], budget); #ifdef ENABLE_MULTIPLE_TX_QUEUE - else if (message_id == 17) + else if (message_id == 17 && tp->num_tx_rings > 1) count += rtl8126_tx_interrupt(&tp->tx_ring[1], budget); #endif break; @@ -16351,7 +17113,7 @@ rtl8126_tx_interrupt_with_vector(struct rtl8126_private *tp, if (message_id == 16) count += rtl8126_tx_interrupt(&tp->tx_ring[0], budget); #ifdef ENABLE_MULTIPLE_TX_QUEUE - else if (message_id == 18) + else if (message_id == 18 && tp->num_tx_rings > 1) count += rtl8126_tx_interrupt(&tp->tx_ring[1], budget); #endif break; @@ -16363,19 +17125,27 @@ rtl8126_tx_interrupt_with_vector(struct rtl8126_private *tp, static inline int rtl8126_fragmented_frame(struct rtl8126_private *tp, u32 status) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: return (status & (FirstFrag_V3 | LastFrag_V3)) != (FirstFrag_V3 | LastFrag_V3); - else + case RX_DESC_RING_TYPE_4: + return (status & (FirstFrag_V4 | LastFrag_V4)) != (FirstFrag_V4 | LastFrag_V4); + default: return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); + } } static inline int rtl8126_is_non_eop(struct rtl8126_private *tp, u32 status) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: return !(status & LastFrag_V3); - else + case RX_DESC_RING_TYPE_4: + return !(status & LastFrag_V4); + default: return !(status & LastFrag); + } } static inline int @@ -16384,6 +17154,20 @@ rtl8126_rx_desc_type(u32 status) return ((status >> 26) & 0x0F); } +static inline void +rtl8126_rx_v1_csum(struct rtl8126_private *tp, + struct sk_buff *skb, + struct RxDesc *desc) +{ + u32 opts1 = le32_to_cpu(desc->opts1); + + if (((opts1 & RxTCPT) && !(opts1 & RxTCPF)) || + ((opts1 & RxUDPT) && !(opts1 & RxUDPF))) + skb->ip_summed = CHECKSUM_UNNECESSARY; + else + skb_checksum_none_assert(skb); +} + static inline void rtl8126_rx_v3_csum(struct rtl8126_private *tp, struct sk_buff *skb, @@ -16399,21 +17183,36 @@ rtl8126_rx_v3_csum(struct rtl8126_private *tp, skb_checksum_none_assert(skb); } +static inline void +rtl8126_rx_v4_csum(struct rtl8126_private *tp, + struct sk_buff *skb, + struct RxDescV4 *descv4) +{ + u32 opts1 = le32_to_cpu(descv4->RxDescNormalDDWord2.opts1); + + /* rx csum offload for RTL8125 */ + if (((opts1 & RxTCPT_v4) && !(opts1 & RxTCPF_v4)) || + ((opts1 & RxUDPT_v4) && !(opts1 & RxUDPF_v4))) + skb->ip_summed = CHECKSUM_UNNECESSARY; + else + skb_checksum_none_assert(skb); +} + static inline void rtl8126_rx_csum(struct rtl8126_private *tp, struct sk_buff *skb, - struct RxDesc *desc, - u32 opts1) + struct RxDesc *desc) { - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: rtl8126_rx_v3_csum(tp, skb, (struct RxDescV3 *)desc); - else { - /* rx csum offload for RTL8125 */ - if (((opts1 & RxTCPT) && !(opts1 & RxTCPF)) || - ((opts1 & RxUDPT) && !(opts1 & RxUDPF))) - skb->ip_summed = CHECKSUM_UNNECESSARY; - else - skb_checksum_none_assert(skb); + break; + case RX_DESC_RING_TYPE_4: + rtl8126_rx_v4_csum(tp, skb, (struct RxDescV4 *)desc); + break; + default: + rtl8126_rx_v1_csum(tp, skb, desc); + break; } } @@ -16473,7 +17272,8 @@ rtl8126_check_rx_desc_error(struct net_device *dev, { int ret = 0; - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: if (unlikely(status & RxRES_V3)) { if (status & (RxRWT_V3 | RxRUNT_V3)) RTLDEV->stats.rx_length_errors++; @@ -16482,7 +17282,18 @@ rtl8126_check_rx_desc_error(struct net_device *dev, ret = -1; } - } else { + break; + case RX_DESC_RING_TYPE_4: + if (unlikely(status & RxRES_V4)) { + if (status & RxRUNT_V4) + RTLDEV->stats.rx_length_errors++; + if (status & RxCRC_V4) + RTLDEV->stats.rx_crc_errors++; + + ret = -1; + } + break; + default: if (unlikely(status & RxRES)) { if (status & (RxRWT | RxRUNT)) RTLDEV->stats.rx_length_errors++; @@ -16491,6 +17302,7 @@ rtl8126_check_rx_desc_error(struct net_device *dev, ret = -1; } + break; } return ret; @@ -16620,10 +17432,6 @@ rtl8126_rx_interrupt(struct net_device *dev, rx_left = rtl8126_rx_quota(rx_left, (u32)rx_quota); for (; rx_left > 0; rx_left--, cur_rx++) { -#ifdef ENABLE_PTP_SUPPORT - u8 desc_type = RXDESC_TYPE_NORMAL; - struct RxDescV3 ptp_desc; -#endif //ENABLE_PTP_SUPPORT #ifndef ENABLE_PAGE_REUSE const void *rx_buf; #endif //!ENABLE_PAGE_REUSE @@ -16632,9 +17440,12 @@ rtl8126_rx_interrupt(struct net_device *dev, entry = cur_rx % ring->num_rx_desc; desc = rtl8126_get_rxdesc(tp, ring->RxDescArray, entry); status = le32_to_cpu(rtl8126_rx_desc_opts1(tp, desc)); - - if (status & DescOwn) - break; + if (status & DescOwn) { + RTL_R8(tp, tp->imr_reg[0]); + status = le32_to_cpu(rtl8126_rx_desc_opts1(tp, desc)); + if (status & DescOwn) + break; + } rmb(); @@ -16695,58 +17506,6 @@ rtl8126_rx_interrupt(struct net_device *dev, goto drop_packet; #endif //!ENABLE_RX_PACKET_FRAGMENT || !ENABLE_PAGE_REUSE -#ifdef ENABLE_PTP_SUPPORT - if (tp->EnablePtp) { - desc_type = rtl8126_rx_desc_type(status); - if (desc_type == RXDESC_TYPE_NEXT && rx_left > 0) { - u32 status_next; - struct RxDescV3 *desc_next; - unsigned int entry_next; - - cur_rx++; - rx_left--; - entry_next = cur_rx % ring->num_rx_desc; - desc_next = (struct RxDescV3 *)rtl8126_get_rxdesc(tp, ring->RxDescArray, entry_next); - status_next = le32_to_cpu(desc_next->RxDescNormalDDWord4.opts1); - if (unlikely(status_next & DescOwn)) { - udelay(1); - status_next = le32_to_cpu(desc_next->RxDescNormalDDWord4.opts1); - if (unlikely(status_next & DescOwn)) { - if (netif_msg_rx_err(tp)) { - printk(KERN_ERR - "%s: Rx Next Desc ERROR. status = %08x\n", - dev->name, status_next); - } - rtl8126_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, - ring->RxDescPhyAddr[entry_next]); - wmb(); - rtl8126_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); - goto drop_packet; - } - } - - rmb(); - - desc_type = rtl8126_rx_desc_type(status_next); - if (desc_type == RXDESC_TYPE_PTP) { - ptp_desc = *desc_next; - rmb(); - rtl8126_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, - ring->RxDescPhyAddr[entry_next]); - wmb(); - rtl8126_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); - } else { - WARN_ON(1); - rtl8126_set_desc_dma_addr(tp, (struct RxDesc *)desc_next, - ring->RxDescPhyAddr[entry_next]); - wmb(); - rtl8126_mark_to_asic(tp, (struct RxDesc *)desc_next, tp->rx_buf_sz); - goto drop_packet; - } - } else - WARN_ON(desc_type != RXDESC_TYPE_NORMAL); - } -#endif #ifdef ENABLE_PAGE_REUSE rxb = &ring->rx_buffer[entry]; skb = rxb->skb; @@ -16765,10 +17524,6 @@ rtl8126_rx_interrupt(struct net_device *dev, } 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) - rtl8126_rx_ptp_pktstamp(tp, skb, &ptp_desc); -#endif //ENABLE_PTP_SUPPORT //recycle desc rtl8126_put_rx_buffer(tp, ring, cur_rx, rxb); @@ -16788,10 +17543,7 @@ rtl8126_rx_interrupt(struct net_device *dev, 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) - 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), rx_buf_phy_addr, tp->rx_buf_sz, @@ -16806,6 +17558,11 @@ rtl8126_rx_interrupt(struct net_device *dev, tp->rx_buf_sz, DMA_FROM_DEVICE); #endif //ENABLE_PAGE_REUSE +#ifdef ENABLE_PTP_SUPPORT + if (tp->flags & RTL_FLAG_RX_HWTSTAMP_ENABLED) + rtl8126_rx_ptp_timestamp(tp, skb); +#endif // ENABLE_PTP_SUPPORT + #ifdef ENABLE_RX_PACKET_FRAGMENT if (rtl8126_is_non_eop(tp, status)) { unsigned int entry_next; @@ -16817,9 +17574,9 @@ rtl8126_rx_interrupt(struct net_device *dev, #endif //ENABLE_RX_PACKET_FRAGMENT #ifdef ENABLE_RSS_SUPPORT - rtl8126_rx_hash(tp, (struct RxDescV3 *)desc, skb); + rtl8126_rx_hash(tp, desc, skb); #endif - rtl8126_rx_csum(tp, skb, desc, status); + rtl8126_rx_csum(tp, skb, desc); skb->protocol = eth_type_trans(skb, dev); @@ -16842,10 +17599,13 @@ rtl8126_rx_interrupt(struct net_device *dev, #endif release_descriptor: - if (tp->InitRxDescType == RX_DESC_RING_TYPE_3) { + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: + case RX_DESC_RING_TYPE_4: rtl8126_set_desc_dma_addr(tp, desc, ring->RxDescPhyAddr[entry]); wmb(); + break; } rtl8126_mark_to_asic(tp, desc, tp->rx_buf_sz); continue; @@ -16963,15 +17723,12 @@ static irqreturn_t rtl8126_interrupt(int irq, void *dev_instance) tp->CmacResetIntr = TRUE; DashIntType2Status = RTL_CMAC_R8(tp, CMAC_IBISR0); - if (DashIntType2Status & ISRIMR_DASH_TYPE2_ROK) { + if (DashIntType2Status & ISRIMR_DASH_TYPE2_ROK) tp->RcvFwDashOkEvt = TRUE; - } - if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) { + if (DashIntType2Status & ISRIMR_DASH_TYPE2_TOK) tp->SendFwHostOkEvt = TRUE; - } - if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) { + if (DashIntType2Status & ISRIMR_DASH_TYPE2_RX_DISABLE_IDLE) tp->DashFwDisableRx = TRUE; - } RTL_CMAC_W8(tp, CMAC_IBISR0, DashIntType2Status); } @@ -17064,6 +17821,10 @@ static irqreturn_t rtl8126_interrupt_msix(int irq, void *dev_instance) dev->name, message_id); rtl8126_clear_hw_isr_v2(tp, message_id); #else + rtl8126_disable_hw_interrupt_v2(tp, message_id); + + rtl8126_clear_hw_isr_v2(tp, message_id); + rtl8126_tx_interrupt_with_vector(tp, message_id, ~(u32)0); if (message_id < tp->num_rx_rings) { diff --git a/r8126_ptp.c b/r8126_ptp.c index 8743f5e..5e62c16 100644 --- a/r8126_ptp.c +++ b/r8126_ptp.c @@ -45,57 +45,90 @@ #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) +static void rtl8126_wait_clkadj_ready(struct rtl8126_private *tp) { - return *(const struct timespec *)&ts64; + int i; + + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) + if (!(rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CLK_CFG_8126) & CLKADJ_MODE_SET)) + break; } -static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) +static void rtl8126_set_clkadj_mode(struct rtl8126_private *tp, u16 cmd) { - return *(const struct timespec64 *)&ts; + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + PTP_CLK_CFG_8126, + BIT_3 | BIT_2 | BIT_1, + CLKADJ_MODE_SET | cmd); + + rtl8126_wait_clkadj_ready(tp); } -#endif 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)); + unsigned long flags; + + spin_lock_irqsave(&tp->phy_lock, flags); + + //Direct Read + rtl8126_set_clkadj_mode(tp, DIRECT_READ); /* nanoseconds */ - //0x6808[29:0] - ts64->tv_nsec = (RTL_R32(tp, PTP_SOFT_CONFIG_Time_NS_8125) & 0x3fffffff); + //Ns[29:16] E414[13:0] + ts64->tv_nsec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_NS_HI_8126) & 0x3fff; + ts64->tv_nsec <<= 16; + //Ns[15:0] E412[15:0] + ts64->tv_nsec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_NS_LO_8126); + /* seconds */ - //0x680C[47:0] - ts64->tv_sec = RTL_R16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4); - ts64->tv_sec <<= 32; - ts64->tv_sec |= RTL_R32(tp, PTP_SOFT_CONFIG_Time_S_8125); + //S[47:32] E41A[15:0] + ts64->tv_sec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_S_HI_8126); + ts64->tv_sec <<= 16; + //S[31:16] E418[15:0] + ts64->tv_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_S_MI_8126); + ts64->tv_sec <<= 16; + //S[15:0] E416[15:0] + ts64->tv_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_S_LO_8126); + + spin_unlock_irqrestore(&tp->phy_lock, flags); return 0; } static int _rtl8126_phc_settime(struct rtl8126_private *tp, const struct timespec64 *ts64) { + unsigned long flags; + + spin_lock_irqsave(&tp->phy_lock, flags); + /* nanoseconds */ - //0x6808[29:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, (ts64->tv_nsec & 0x3fffffff)); + //Ns[15:0] E412[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_NS_LO_8126, ts64->tv_nsec); + //Ns[29:16] E414[13:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_NS_HI_8126, (ts64->tv_nsec & 0x3fff0000) >> 16); /* seconds */ - //0x680C[47:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_S_8125, ts64->tv_sec); - RTL_W16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4, (ts64->tv_sec >> 32)); + //S[15:0] E416[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_S_LO_8126, ts64->tv_sec); + //S[31:16] E418[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_S_MI_8126, (ts64->tv_sec >> 16)); + //S[47:32] E41A[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_S_HI_8126, (ts64->tv_sec >> 32)); + + //Direct Write + rtl8126_set_clkadj_mode(tp, DIRECT_WRITE); - //set local time - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD)); + spin_unlock_irqrestore(&tp->phy_lock, flags); return 0; } static int _rtl8126_phc_adjtime(struct rtl8126_private *tp, s64 delta) { + unsigned long flags; struct timespec64 d; - bool negative = false; + bool negative; u64 tohw; u32 nsec; u64 sec; @@ -104,6 +137,7 @@ static int _rtl8126_phc_adjtime(struct rtl8126_private *tp, s64 delta) negative = true; tohw = -delta; } else { + negative = false; tohw = delta; } @@ -112,31 +146,31 @@ static int _rtl8126_phc_adjtime(struct rtl8126_private *tp, s64 delta) nsec = d.tv_nsec; sec = d.tv_sec; - if (negative) { - nsec = -nsec; - sec = -sec; - } - nsec &= 0x3fffffff; sec &= 0x0000ffffffffffff; - if (negative) { - nsec |= PTP_SOFT_CONFIG_TIME_NS_NEGATIVE; - sec |= PTP_SOFT_CONFIG_TIME_S_NEGATIVE; - } + spin_lock_irqsave(&tp->phy_lock, flags); /* nanoseconds */ - //0x6808[29:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, nsec); + //Ns[15:0] E412[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_NS_LO_8126, nsec); + //Ns[29:16] E414[13:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_NS_HI_8126, (nsec >> 16)); /* seconds */ - //0x680C[47:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_S_8125, sec); - RTL_W16(tp, PTP_SOFT_CONFIG_Time_S_8125 + 4, (sec >> 32)); + //S[15:0] E416[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_S_LO_8126, sec); + //S[31:16] E418[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_S_MI_8126, (sec >> 16)); + //S[47:32] E41A[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_S_HI_8126, (sec >> 32)); + + if (negative) + rtl8126_set_clkadj_mode(tp, DECREMENT_STEP); + else + rtl8126_set_clkadj_mode(tp, INCREMENT_STEP); - //adjust local time - //RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_DRIFT_LOCAL_TIME | PTP_EXEC_CMD)); - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD)); + spin_unlock_irqrestore(&tp->phy_lock, flags); return 0; } @@ -148,57 +182,60 @@ static int rtl8126_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) //netif_info(tp, drv, tp->dev, "phc adjust time\n"); - rtnl_lock(); ret = _rtl8126_phc_adjtime(tp, delta); - rtnl_unlock(); return ret; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) /* -1ppm means every 125MHz plus 125Hz. It also means every 8ns minus 8ns*10^(-6) - -1ns=2^30 sub_ns - -8ns*10^(-6) = 8 * 2^30 sub_ns * 10^(-6) = 2^33 sub_ns * 10^(-6) = 8590 = 0x218E sub_ns - -1ppb means every 125MHz plus 0.125Hz. It also means every 8ns minus 8ns*10^(-9) - -1ns=2^30 sub_ns - -8ns*10^(-9) = 8 * 2^30 sub_ns * 10^(-9) = 2^33 sub_ns * 10^(-9) = 8.59 sub_ns = 9 sub_ns -*/ + * delta = delta * 10^6 ppm = delta * 10^9 ppb (in this equation ppm and ppb are not variable) + * + * in adjfreq ppb is a variable + * ppb = delta * 10^9 + * delta = ppb / 10^9 + * rate_value = |delta| * 2^32 = |ppb| / 10^9 * 2^32 = (|ppb| << 32) / 10^9 + */ static int _rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 ppb) { struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); - bool negative = false; - u32 sub_ns; + unsigned long flags; + u32 rate_value; if (ppb < 0) { - negative = true; - ppb = -ppb; - } - - sub_ns = ppb * 9; - if (negative) { - sub_ns = -sub_ns; - sub_ns &= 0x3fffffff; - sub_ns |= PTP_ADJUST_TIME_NS_NEGATIVE; + rate_value = ((u64)-ppb << 32) / 1000000000; + rate_value = ~rate_value + 1; } else - sub_ns &= 0x3fffffff; + rate_value = ((u64)ppb << 32) / 1000000000; + + spin_lock_irqsave(&tp->phy_lock, flags); /* nanoseconds */ - //0x6808[29:0] - RTL_W32(tp, PTP_SOFT_CONFIG_Time_NS_8125, sub_ns); + //Ns[15:0] E412[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_NS_LO_8126, rate_value); + //Ns[22:16] E414[13:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CFG_NS_HI_8126, (rate_value & 0x003f0000) >> 16); + + rtl8126_set_clkadj_mode(tp, RATE_WRITE); + + spin_unlock_irqrestore(&tp->phy_lock, flags); + + return 0; +} + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) +static int rtl8126_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) +{ + s32 ppb = scaled_ppm_to_ppb(scaled_ppm); + + if (ppb > ptp->max_adj || ppb < -ptp->max_adj) + return -EINVAL; - //adjust local time - RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_DRIFT_LOCAL_TIME | PTP_EXEC_CMD)); - //RTL_W16(tp, PTP_TIME_CORRECT_CMD_8125, (PTP_CMD_SET_LOCAL_TIME | PTP_EXEC_CMD)); + _rtl8126_phc_adjfreq(ptp, ppb); return 0; } +#else static int rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) { //struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); @@ -212,8 +249,24 @@ static int rtl8126_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) return 0; } -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) +static int rtl8126_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts64, + struct ptp_system_timestamp *sts) +{ + 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"); + + ptp_read_system_prets(sts); + ret = _rtl8126_phc_gettime(tp, ts64); + ptp_read_system_postts(sts); + return ret; +} +#else static int rtl8126_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts64) { struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); @@ -221,12 +274,11 @@ static int rtl8126_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts //netif_info(tp, drv, tp->dev, "phc get ts\n"); - rtnl_lock(); ret = _rtl8126_phc_gettime(tp, ts64); - rtnl_unlock(); return ret; } +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) */ static int rtl8126_phc_settime(struct ptp_clock_info *ptp, const struct timespec64 *ts64) @@ -236,38 +288,74 @@ static int rtl8126_phc_settime(struct ptp_clock_info *ptp, //netif_info(tp, drv, tp->dev, "phc set ts\n"); - rtnl_lock(); ret = _rtl8126_phc_settime(tp, ts64); - rtnl_unlock(); return ret; } -static int rtl8126_phc_enable(struct ptp_clock_info *ptp, - struct ptp_clock_request *rq, int on) +static void _rtl8126_phc_enable(struct ptp_clock_info *ptp, + struct ptp_clock_request *rq, int on) { struct rtl8126_private *tp = container_of(ptp, struct rtl8126_private, ptp_clock_info); - u16 ptp_ctrl; + unsigned long flags; + u16 phy_ocp_data; + + if (on) { + tp->pps_enable = 1; + rtl8126_clear_mac_ocp_bit(tp, 0xDC00, BIT_6); + rtl8126_clear_mac_ocp_bit(tp, 0xDC20, BIT_1); + + spin_lock_irqsave(&tp->phy_lock, flags); + + /* Set periodic pulse 1pps */ + /* E432[8:0] = 0x017d */ + phy_ocp_data = rtl8126_mdio_direct_read_phy_ocp(tp, 0xE432); + phy_ocp_data &= 0xFE00; + phy_ocp_data |= 0x017d; + rtl8126_mdio_direct_write_phy_ocp(tp, 0xE432, phy_ocp_data); + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xE434, 0x7840); + + /* E436[8:0] = 0xbe */ + phy_ocp_data = rtl8126_mdio_direct_read_phy_ocp(tp, 0xE436); + phy_ocp_data &= 0xFE00; + phy_ocp_data |= 0xbe; + rtl8126_mdio_direct_write_phy_ocp(tp, 0xE436, phy_ocp_data); + + rtl8126_mdio_direct_write_phy_ocp(tp, 0xE438, 0xbc20); + + spin_unlock_irqrestore(&tp->phy_lock, flags); - //netif_info(tp, drv, tp->dev, "phc enable type %x on %d\n", rq->type, on); + /* start hrtimer */ + hrtimer_start(&tp->pps_timer, 1000000000, HRTIMER_MODE_REL); + } else + tp->pps_enable = 0; +} +static int rtl8126_phc_enable(struct ptp_clock_info *ptp, + struct ptp_clock_request *rq, int on) +{ switch (rq->type) { case PTP_CLK_REQ_PPS: - rtnl_lock(); - ptp_ctrl = RTL_R16(tp, PTP_CTRL_8125); - ptp_ctrl &= ~BIT_15; - if (on) - ptp_ctrl |= BIT_14; - else - ptp_ctrl &= ~BIT_14; - RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl); - rtnl_unlock(); + _rtl8126_phc_enable(ptp, rq, on); return 0; default: return -EOPNOTSUPP; } } +static void rtl8126_ptp_enable_config(struct rtl8126_private *tp) +{ + if (tp->syncE_en) + rtl8126_set_eth_phy_ocp_bit(tp, PTP_SYNCE_CTL, BIT_0); + else + rtl8126_clear_eth_phy_ocp_bit(tp, PTP_SYNCE_CTL, BIT_0); + + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_CTL, PTP_CTL_TYPE_3 | BIT_12); + + rtl8126_set_eth_phy_ocp_bit(tp, 0xA640, BIT_15); +} + int rtl8126_get_ts_info(struct net_device *netdev, struct ethtool_ts_info *info) { @@ -311,53 +399,163 @@ static const struct ptp_clock_info rtl_ptp_clock_info = { .n_per_out = 0, .n_pins = 0, .pps = 1, -#if LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) + .adjfine = rtl8126_ptp_adjfine, +#else .adjfreq = rtl8126_phc_adjfreq, -#endif //LINUX_VERSION_CODE < KERNEL_VERSION(6,2,0) +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) */ .adjtime = rtl8126_phc_adjtime, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) + .gettimex64 = rtl8126_phc_gettime, +#else .gettime64 = rtl8126_phc_gettime, +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0) */ + .settime64 = rtl8126_phc_settime, .enable = rtl8126_phc_enable, }; -static int rtl8126_ptp_egresstime(struct rtl8126_private *tp, struct timespec64 *ts64, u32 regnum) +static u16 rtl8126_ptp_get_tx_msgtype(struct rtl8126_private *tp) { + u16 tx_ts_ready = 0; + int i; + + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + tx_ts_ready = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_STA) & 0xF000; + if (tx_ts_ready) + break; + } + + switch (tx_ts_ready) { + case TX_TS_PDLYRSP_RDY: + return PTP_MSGTYPE_PDELAY_RESP; + case TX_TS_PDLYREQ_RDY: + return PTP_MSGTYPE_PDELAY_REQ; + case TX_TS_DLYREQ_RDY: + return PTP_MSGTYPE_DELAY_REQ; + case TX_TS_SYNC_RDY: + default: + return PTP_MSGTYPE_SYNC; + } +} + +/* +static u16 rtl8126_ptp_get_rx_msgtype(struct rtl8126_private *tp) +{ + u16 rx_ts_ready = 0; + int i; + + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) { + rx_ts_ready = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_STA) & 0x0F00; + if (rx_ts_ready) + break; + } + + switch (rx_ts_ready) { + case RX_TS_PDLYRSP_RDY: + return PTP_MSGTYPE_PDELAY_RESP; + case RX_TS_PDLYREQ_RDY: + return PTP_MSGTYPE_PDELAY_REQ; + case RX_TS_DLYREQ_RDY: + return PTP_MSGTYPE_DELAY_REQ; + case RX_TS_SYNC_RDY: + default: + return PTP_MSGTYPE_SYNC; + } +} +*/ + +static void rtl8126_wait_trx_ts_ready(struct rtl8126_private *tp) +{ + int i; + + for (i = 0; i < R8126_CHANNEL_WAIT_COUNT; i++) + if (!(rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_STA) & TRX_TS_RD)) + break; +} + +static void rtl8126_set_trx_ts_cmd(struct rtl8126_private *tp, u16 cmd) +{ + rtl8126_clear_and_set_eth_phy_ocp_bit(tp, + PTP_TRX_TS_STA, + TRXTS_SEL | BIT_3 | BIT_2, + TRX_TS_RD | cmd); + + rtl8126_wait_trx_ts_ready(tp); +} + +static void rtl8126_ptp_egresstime(struct rtl8126_private *tp, struct timespec64 *ts64) +{ + u16 msgtype; + + msgtype = rtl8126_ptp_get_tx_msgtype(tp); + + msgtype <<= 2; + + rtl8126_set_trx_ts_cmd(tp, (msgtype | BIT_4)); + /* nanoseconds */ - //[29:0] - ts64->tv_nsec = rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16 + 2); + //Ns[29:16] E448[13:0] + ts64->tv_nsec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_NS_HI) & 0x3fff; ts64->tv_nsec <<= 16; - ts64->tv_nsec |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_NS_8125 + regnum * 16); - ts64->tv_nsec &= 0x3fffffff; + //Ns[15:0] E446[15:0] + ts64->tv_nsec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_NS_LO); /* seconds */ - //[47:0] - ts64->tv_sec = rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16 + 4); + //S[47:32] E44E[15:0] + ts64->tv_sec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_S_HI); ts64->tv_sec <<= 16; - ts64->tv_sec |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16 + 2); + //S[31:16] E44C[15:0] + ts64->tv_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_S_MI); ts64->tv_sec <<= 16; - ts64->tv_sec |= rtl8126_mac_ocp_read(tp, PTP_EGRESS_TIME_BASE_S_8125 + regnum * 16); - ts64->tv_sec &= 0x0000ffffffffffff; + //S[15:0] E44A[15:0] + ts64->tv_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_S_LO); +} - return 0; +static void rtl8126_ptp_ingresstime(struct rtl8126_private *tp, struct timespec64 *ts64, u8 type) +{ + u16 msgtype; + + switch (type) { + case PTP_MSGTYPE_PDELAY_RESP: + case PTP_MSGTYPE_PDELAY_REQ: + case PTP_MSGTYPE_DELAY_REQ: + case PTP_MSGTYPE_SYNC: + msgtype = type << 2; + break; + default: + return; + } + + rtl8126_set_trx_ts_cmd(tp, (TRXTS_SEL | msgtype | BIT_4)); + + /* nanoseconds */ + //Ns[29:16] E448[13:0] + ts64->tv_nsec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_NS_HI) & 0x3fff; + ts64->tv_nsec <<= 16; + //Ns[15:0] E446[15:0] + ts64->tv_nsec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_NS_LO); + + /* seconds */ + //S[47:32] E44E[15:0] + ts64->tv_sec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_S_HI); + ts64->tv_sec <<= 16; + //S[31:16] E44C[15:0] + ts64->tv_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_S_MI); + ts64->tv_sec <<= 16; + //S[15:0] E44A[15:0] + ts64->tv_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_TRX_TS_S_LO); } static void rtl8126_ptp_tx_hwtstamp(struct rtl8126_private *tp) { struct sk_buff *skb = tp->ptp_tx_skb; - struct skb_shared_hwtstamps shhwtstamps = {0}; + struct skb_shared_hwtstamps shhwtstamps = { 0 }; struct timespec64 ts64; - u32 regnum; - RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER); + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_INSR, TX_TX_INTR); - //IO 0x2302 bit 10~11 WR_PTR - regnum = RTL_R16(tp, 0x2032) & 0x0C00; - regnum >>= 10; - regnum = (regnum + 3) % 4; - - rtnl_lock(); - rtl8126_ptp_egresstime(tp, &ts64, regnum); - rtnl_unlock(); + rtl8126_ptp_egresstime(tp, &ts64); /* Upper 32 bits contain s, lower 32 bits contain ns. */ shhwtstamps.hwtstamp = ktime_set(ts64.tv_sec, @@ -381,6 +579,7 @@ static void rtl8126_ptp_tx_work(struct work_struct *work) { struct rtl8126_private *tp = container_of(work, struct rtl8126_private, ptp_tx_work); + unsigned long flags; if (!tp->ptp_tx_skb) return; @@ -394,47 +593,66 @@ static void rtl8126_ptp_tx_work(struct work_struct *work) /* Clear the tx valid bit in TSYNCTXCTL register to enable * interrupt */ - RTL_W8(tp, PTP_ISR_8125, PTP_ISR_TOK | PTP_ISR_TER); + spin_lock_irqsave(&tp->phy_lock, flags); + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_INSR, TX_TX_INTR); + spin_unlock_irqrestore(&tp->phy_lock, flags); return; } - if (RTL_R8(tp, PTP_ISR_8125) & (PTP_ISR_TOK)) + spin_lock_irqsave(&tp->phy_lock, flags); + if (rtl8126_mdio_direct_read_phy_ocp(tp, PTP_INSR) & TX_TX_INTR) { rtl8126_ptp_tx_hwtstamp(tp); - else + spin_unlock_irqrestore(&tp->phy_lock, flags); + } else { + spin_unlock_irqrestore(&tp->phy_lock, flags); /* reschedule to check later */ schedule_work(&tp->ptp_tx_work); - + } } static int rtl8126_hwtstamp_enable(struct rtl8126_private *tp, bool enable) { - RTL_W16(tp, PTP_CTRL_8125, 0); + unsigned long flags; + + spin_lock_irqsave(&tp->phy_lock, flags); + if (enable) { - u16 ptp_ctrl; - struct timespec64 ts64; + //trx timestamp interrupt enable + rtl8126_set_eth_phy_ocp_bit(tp, PTP_INER, BIT_2 | BIT_3); + + //set isr clear mode + rtl8126_set_eth_phy_ocp_bit(tp, PTP_GEN_CFG, BIT_0); //clear ptp isr - RTL_W8(tp, PTP_ISR_8125, 0xff); - //ptp source 0:gphy 1:mac - rtl8126_mac_ocp_write(tp, 0xDC00, rtl8126_mac_ocp_read(tp, 0xDC00) | BIT_6); + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_INSR, 0xFFFF); + //enable ptp - ptp_ctrl = (BIT_0 | BIT_3 | BIT_4 | BIT_6 | BIT_10 | BIT_12); - if (tp->ptp_master_mode) - ptp_ctrl |= BIT_1; - RTL_W16(tp, PTP_CTRL_8125, ptp_ctrl); - - //set system time - /* - if (ktime_to_timespec64_cond(ktime_get_real(), &ts64)) - _rtl8126_phc_settime(tp, timespec64_to_timespec(ts64)); - */ - ktime_get_real_ts64(&ts64); - _rtl8126_phc_settime(tp, &ts64); + rtl8126_ptp_enable_config(tp); + + //rtl8126_set_local_time(tp); + } else { + /* trx timestamp interrupt disable */ + rtl8126_clear_eth_phy_ocp_bit(tp, PTP_INER, BIT_2 | BIT_3); + + /* disable ptp */ + rtl8126_clear_eth_phy_ocp_bit(tp, PTP_SYNCE_CTL, BIT_0); + rtl8126_clear_eth_phy_ocp_bit(tp, PTP_CTL, BIT_0); + rtl8126_set_eth_phy_ocp_bit(tp, 0xA640, BIT_15); } + spin_unlock_irqrestore(&tp->phy_lock, flags); + return 0; } +void rtl8126_set_local_time(struct rtl8126_private *tp) +{ + struct timespec64 ts64; + //set system time + ktime_get_real_ts64(&ts64); + _rtl8126_phc_settime(tp, &ts64); +} + static long rtl8126_ptp_create_clock(struct rtl8126_private *tp) { struct net_device *netdev = tp->dev; @@ -449,9 +667,10 @@ static long rtl8126_ptp_create_clock(struct rtl8126_private *tp) } tp->ptp_clock_info = rtl_ptp_clock_info; + tp->ptp_clock_info.max_adj = 488281;//0x1FFFFF * 10^9 / 2^32 + snprintf(tp->ptp_clock_info.name, sizeof(tp->ptp_clock_info.name), "%pm", tp->dev->dev_addr); - tp->ptp_clock_info.max_adj = 119304647; tp->ptp_clock = ptp_clock_register(&tp->ptp_clock_info, &tp->pci_dev->dev); if (IS_ERR(tp->ptp_clock)) { err = PTR_ERR(tp->ptp_clock); @@ -464,6 +683,43 @@ static long rtl8126_ptp_create_clock(struct rtl8126_private *tp) return 0; } +static enum hrtimer_restart +rtl8126_hrtimer_for_pps(struct hrtimer *timer) { + struct rtl8126_private *tp = container_of(timer, struct rtl8126_private, pps_timer); + u16 tai_cfg = BIT_8 | BIT_3 | BIT_1 | BIT_0; + s64 pps_sec; + + if (tp->pps_enable) + { + unsigned long flags; + + spin_lock_irqsave(&tp->phy_lock, flags); + + //Direct Read + rtl8126_set_clkadj_mode(tp, DIRECT_READ); + + pps_sec = rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_S_HI_8126); + pps_sec <<= 16; + pps_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_S_MI_8126); + pps_sec <<= 16; + pps_sec |= rtl8126_mdio_direct_read_phy_ocp(tp, PTP_CFG_S_LO_8126); + pps_sec++; + + //E42A[15:0] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_TAI_TS_S_LO, pps_sec & 0xffff); + //E42C[31:16] + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_TAI_TS_S_HI, (pps_sec & 0xffff0000) >> 16); + //Periodic Tai start + rtl8126_mdio_direct_write_phy_ocp(tp, PTP_TAI_CFG, tai_cfg); + + spin_unlock_irqrestore(&tp->phy_lock, flags); + + hrtimer_forward_now(&tp->pps_timer, 1000000000); //rekick + return HRTIMER_RESTART; + } else + return HRTIMER_NORESTART; +} + void rtl8126_ptp_reset(struct rtl8126_private *tp) { if (!tp->ptp_clock) @@ -483,6 +739,11 @@ void rtl8126_ptp_init(struct rtl8126_private *tp) /* we have a clock so we can initialize work now */ INIT_WORK(&tp->ptp_tx_work, rtl8126_ptp_tx_work); + /* init a hrtimer for pps */ + tp->pps_enable = 0; + hrtimer_init(&tp->pps_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + tp->pps_timer.function = rtl8126_hrtimer_for_pps; + /* reset the PTP related hardware bits */ rtl8126_ptp_reset(tp); @@ -500,6 +761,8 @@ void rtl8126_ptp_suspend(struct rtl8126_private *tp) /* ensure that we cancel any pending PTP Tx work item in progress */ cancel_work_sync(&tp->ptp_tx_work); + + hrtimer_cancel(&tp->pps_timer); } void rtl8126_ptp_stop(struct rtl8126_private *tp) @@ -537,6 +800,7 @@ static int rtl8126_set_tstamp(struct net_device *netdev, struct ifreq *ifr) switch (config.tx_type) { case HWTSTAMP_TX_ON: hwtstamp = 1; + break; case HWTSTAMP_TX_OFF: break; case HWTSTAMP_TX_ONESTEP_SYNC: @@ -556,15 +820,20 @@ static int rtl8126_set_tstamp(struct net_device *netdev, struct ifreq *ifr) case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; hwtstamp = 1; + tp->flags |= RTL_FLAG_RX_HWTSTAMP_ENABLED; + break; case HWTSTAMP_FILTER_NONE: + tp->flags &= ~RTL_FLAG_RX_HWTSTAMP_ENABLED; break; default: + tp->flags &= ~RTL_FLAG_RX_HWTSTAMP_ENABLED; return -ERANGE; } if (tp->hwtstamp_config.tx_type != config.tx_type || tp->hwtstamp_config.rx_filter != config.rx_filter) { tp->hwtstamp_config = config; + rtl8126_hwtstamp_enable(tp, hwtstamp); } @@ -605,15 +874,71 @@ int rtl8126_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) return ret; } -void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb, - struct RxDescV3 *descv3) +static void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb, u8 type) { - time64_t tv_sec; - long tv_nsec; + struct timespec64 ts64; + unsigned long flags; + + spin_lock_irqsave(&tp->phy_lock, flags); + + rtl8126_ptp_ingresstime(tp, &ts64, type); + + spin_unlock_irqrestore(&tp->phy_lock, flags); + + skb_hwtstamps(skb)->hwtstamp = ktime_set(ts64.tv_sec, ts64.tv_nsec); + + return; +} + +void rtl8126_rx_ptp_timestamp(struct rtl8126_private *tp, struct sk_buff *skb) +{ + unsigned int ptp_class; + struct ptp_header *hdr; + u8 msgtype; + + ptp_class = ptp_classify_raw(skb); + if (ptp_class == PTP_CLASS_NONE) + return; + + skb_reset_mac_header(skb); + hdr = ptp_parse_header(skb, ptp_class); + if (unlikely(!hdr)) + return; + + msgtype = ptp_get_msgtype(hdr, ptp_class); + rtl8126_rx_ptp_pktstamp(tp, skb, msgtype); + + return; +} + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) +struct ptp_header *ptp_parse_header(struct sk_buff *skb, unsigned int type) +{ + u8 *ptr = skb_mac_header(skb); + + if (type & PTP_CLASS_VLAN) + //ptr += VLAN_HLEN; + ptr += 4; + + switch (type & PTP_CLASS_PMASK) { + case PTP_CLASS_IPV4: + ptr += IPV4_HLEN(ptr) + UDP_HLEN; + break; + case PTP_CLASS_IPV6: + ptr += IP6_HLEN + UDP_HLEN; + break; + case PTP_CLASS_L2: + break; + default: + return NULL; + } + + ptr += ETH_HLEN; - tv_sec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampHigh) + - ((u64)le32_to_cpu(descv3->RxDescPTPDDWord4.TimeStampHHigh) << 32); - tv_nsec = le32_to_cpu(descv3->RxDescTimeStamp.TimeStampLow); + /* Ensure that the entire header is present in this packet. */ + if (ptr + sizeof(struct ptp_header) > skb->data + skb->len) + return NULL; - skb_hwtstamps(skb)->hwtstamp = ktime_set(tv_sec, tv_nsec); + return (struct ptp_header *)ptr; } +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) */ diff --git a/r8126_ptp.h b/r8126_ptp.h index 37b72b0..ea4cac2 100644 --- a/r8126_ptp.h +++ b/r8126_ptp.h @@ -41,6 +41,23 @@ #include #include +#ifndef PTP_CLASS_NONE +#define PTP_CLASS_NONE 0x00 +#endif + +#ifndef PTP_MSGTYPE_SYNC +#define PTP_MSGTYPE_SYNC 0x0 +#endif +#ifndef PTP_MSGTYPE_DELAY_REQ +#define PTP_MSGTYPE_DELAY_REQ 0x1 +#endif +#ifndef PTP_MSGTYPE_PDELAY_REQ +#define PTP_MSGTYPE_PDELAY_REQ 0x2 +#endif +#ifndef PTP_MSGTYPE_PDELAY_RESP +#define PTP_MSGTYPE_PDELAY_RESP 0x3 +#endif + struct rtl8126_ptp_info { s64 time_sec; u32 time_ns; @@ -61,6 +78,109 @@ enum PTP_CMD_TYPE { PTP_CMD_LATCHED_LOCAL_TIME, }; +enum PTP_CLKADJ_MOD_TYPE { + NO_FUNCTION = 0, + CLKADJ_MODE_SET = 1, + RESERVED = 2, + DIRECT_READ = 4, + DIRECT_WRITE = 6, + INCREMENT_STEP = 8, + DECREMENT_STEP = 10, + RATE_READ = 12, + RATE_WRITE = 14, +}; + +enum PTP_INSR_TYPE { + EVENT_CAP_INTR = (1 << 0), + TRIG_GEN_INTR = (1 << 1), + RX_TS_INTR = (1 << 2), + TX_TX_INTR = (1 << 3), +}; + +enum PTP_TRX_TS_STA_REG { + TRX_TS_RD = (1 << 0), + TRXTS_SEL = (1 << 1), + RX_TS_PDLYRSP_RDY = (1 << 8), + RX_TS_PDLYREQ_RDY = (1 << 9), + RX_TS_DLYREQ_RDY = (1 << 10), + RX_TS_SYNC_RDY = (1 << 11), + TX_TS_PDLYRSP_RDY = (1 << 12), + TX_TS_PDLYREQ_RDY = (1 << 13), + TX_TS_DLYREQ_RDY = (1 << 14), + TX_TS_SYNC_RDY = (1 << 15), +}; + +#define PTP_CTL_TYPE_0 (0xF3F) +#define PTP_CTL_TYPE_1 (0x2FF) +#define PTP_CTL_TYPE_2 (0x0FF) +#define PTP_CTL_TYPE_3 (0x03F) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) +struct clock_identity { + u8 id[8]; +} __packed; + +struct port_identity { + struct clock_identity clock_identity; + __be16 port_number; +} __packed; + +struct ptp_header { + u8 tsmt; /* transportSpecific | messageType */ + u8 ver; /* reserved | versionPTP */ + __be16 message_length; + u8 domain_number; + u8 reserved1; + u8 flag_field[2]; + __be64 correction; + __be32 reserved2; + struct port_identity source_port_identity; + __be16 sequence_id; + u8 control; + u8 log_message_interval; +} __packed; + +/** + * ptp_parse_header - Get pointer to the PTP v2 header + * @skb: packet buffer + * @type: type of the packet (see ptp_classify_raw()) + * + * This function takes care of the VLAN, UDP, IPv4 and IPv6 headers. The length + * is checked. + * + * Note, internally skb_mac_header() is used. Make sure that the @skb is + * initialized accordingly. + * + * Return: Pointer to the ptp v2 header or NULL if not found + */ +struct ptp_header *ptp_parse_header(struct sk_buff *skb, unsigned int type); + +/** + * ptp_get_msgtype - Extract ptp message type from given header + * @hdr: ptp header + * @type: type of the packet (see ptp_classify_raw()) + * + * This function returns the message type for a given ptp header. It takes care + * of the different ptp header versions (v1 or v2). + * + * Return: The message type + */ +static inline u8 ptp_get_msgtype(const struct ptp_header *hdr, + unsigned int type) +{ + u8 msgtype; + + if (unlikely(type & PTP_CLASS_V1)) { + /* msg type is located at the control field for ptp v1 */ + msgtype = hdr->control; + } else { + msgtype = hdr->tsmt & 0x0f; + } + + return msgtype; +} + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) */ struct rtl8126_private; struct RxDescV3; @@ -75,7 +195,8 @@ void rtl8126_ptp_stop(struct rtl8126_private *tp); int rtl8126_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd); -void rtl8126_rx_ptp_pktstamp(struct rtl8126_private *tp, struct sk_buff *skb, - struct RxDescV3 *descv3); +void rtl8126_rx_ptp_timestamp(struct rtl8126_private *tp, struct sk_buff *skb); + +void rtl8126_set_local_time(struct rtl8126_private *tp); #endif /* _LINUX_R8126_PTP_H */ diff --git a/r8126_rss.c b/r8126_rss.c index 666e24e..eaf1854 100644 --- a/r8126_rss.c +++ b/r8126_rss.c @@ -91,8 +91,6 @@ int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, struct rtl8126_private *tp = netdev_priv(dev); int ret = -EOPNOTSUPP; - netif_info(tp, drv, tp->dev, "rss get rxnfc\n"); - if (!(dev->features & NETIF_F_RXHASH)) return ret; @@ -159,8 +157,6 @@ static int rtl8126_set_rss_hash_opt(struct rtl8126_private *tp, { u32 rss_flags = tp->rss_flags; - netif_info(tp, drv, tp->dev, "rss set hash\n"); - /* * RSS does not support anything other than hashing * to queues on src and dst IPs and ports @@ -271,8 +267,6 @@ int rtl8126_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) struct rtl8126_private *tp = netdev_priv(dev); int ret = -EOPNOTSUPP; - netif_info(tp, drv, tp->dev, "rss set rxnfc\n"); - if (!(dev->features & NETIF_F_RXHASH)) return ret; @@ -296,8 +290,6 @@ u32 rtl8126_get_rxfh_key_size(struct net_device *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; @@ -308,8 +300,6 @@ u32 rtl8126_rss_indir_size(struct net_device *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; @@ -324,28 +314,6 @@ static void rtl8126_get_reta(struct rtl8126_private *tp, u32 *indir) indir[i] = tp->rss_indir_tbl[i]; } -int rtl8126_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, - u8 *hfunc) -{ - struct rtl8126_private *tp = netdev_priv(dev); - - netif_info(tp, drv, tp->dev, "rss get rxfh\n"); - - if (!(dev->features & NETIF_F_RXHASH)) - return -EOPNOTSUPP; - - if (hfunc) - *hfunc = ETH_RSS_HASH_TOP; - - if (indir) - rtl8126_get_reta(tp, indir); - - if (key) - memcpy(key, tp->rss_key, RTL8126_RSS_KEY_SIZE); - - return 0; -} - static u32 rtl8126_rss_key_reg(struct rtl8126_private *tp) { return RSS_KEY_8125; @@ -386,6 +354,82 @@ static void rtl8126_store_rss_key(struct rtl8126_private *tp) RTL_W32(tp, rss_key_reg + i, *rss_key++); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) +int rtl8126_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh) +{ + struct rtl8126_private *tp = netdev_priv(dev); + + if (!(dev->features & NETIF_F_RXHASH)) + return -EOPNOTSUPP; + + rxfh->hfunc = ETH_RSS_HASH_TOP; + + if (rxfh->indir) + rtl8126_get_reta(tp, rxfh->indir); + + if (rxfh->key) + memcpy(rxfh->key, tp->rss_key, RTL8126_RSS_KEY_SIZE); + + return 0; +} + +int rtl8126_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh, + struct netlink_ext_ack *extack) +{ + struct rtl8126_private *tp = netdev_priv(dev); + int i; + u32 reta_entries = rtl8126_rss_indir_tbl_entries(tp); + + /* We require at least one supported parameter to be changed and no + * change in any of the unsupported parameters + */ + if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && rxfh->hfunc != ETH_RSS_HASH_TOP) + return -EOPNOTSUPP; + + /* Fill out the redirection table */ + if (rxfh->indir) { + int max_queues = tp->num_rx_rings; + + /* Verify user input. */ + for (i = 0; i < reta_entries; i++) + if (rxfh->indir[i] >= max_queues) + return -EINVAL; + + for (i = 0; i < reta_entries; i++) + tp->rss_indir_tbl[i] = rxfh->indir[i]; + } + + /* Fill out the rss hash key */ + if (rxfh->key) + memcpy(tp->rss_key, rxfh->key, RTL8126_RSS_KEY_SIZE); + + rtl8126_store_reta(tp); + + rtl8126_store_rss_key(tp); + + return 0; +} +#else +int rtl8126_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, + u8 *hfunc) +{ + struct rtl8126_private *tp = netdev_priv(dev); + + if (!(dev->features & NETIF_F_RXHASH)) + return -EOPNOTSUPP; + + if (hfunc) + *hfunc = ETH_RSS_HASH_TOP; + + if (indir) + rtl8126_get_reta(tp, indir); + + if (key) + memcpy(key, tp->rss_key, RTL8126_RSS_KEY_SIZE); + + return 0; +} + int rtl8126_set_rxfh(struct net_device *dev, const u32 *indir, const u8 *key, const u8 hfunc) { @@ -393,8 +437,6 @@ int rtl8126_set_rxfh(struct net_device *dev, const u32 *indir, int i; u32 reta_entries = rtl8126_rss_indir_tbl_entries(tp); - netif_info(tp, drv, tp->dev, "rss set rxfh\n"); - /* We require at least one supported parameter to be changed and no * change in any of the unsupported parameters */ @@ -424,11 +466,19 @@ int rtl8126_set_rxfh(struct net_device *dev, const u32 *indir, return 0; } +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */ static u32 rtl8126_get_rx_desc_hash(struct rtl8126_private *tp, - struct RxDescV3 *descv3) + struct RxDesc *desc) { - return le32_to_cpu(descv3->RxDescNormalDDWord2.RSSResult); + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: + return le32_to_cpu(((struct RxDescV3 *)desc)->RxDescNormalDDWord2.RSSResult); + case RX_DESC_RING_TYPE_4: + return le32_to_cpu(((struct RxDescV4 *)desc)->RxDescNormalDDWord1.RSSResult); + default: + return 0; + } } #define RXS_8125B_RSS_UDP BIT(9) @@ -437,9 +487,16 @@ static u32 rtl8126_get_rx_desc_hash(struct rtl8126_private *tp, #define RXS_8125_RSS_TCP BIT(13) #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) + +#define RXS_8125B_RSS_UDP_V4 BIT(27) +#define RXS_8125_RSS_IPV4_V4 BIT(28) +#define RXS_8125_RSS_IPV6_V4 BIT(29) +#define RXS_8125_RSS_TCP_V4 BIT(30) +#define RTL8126_RXS_RSS_L3_TYPE_MASK_V4 (RXS_8125_RSS_IPV4_V4 | RXS_8125_RSS_IPV6_V4) +#define RTL8126_RXS_RSS_L4_TYPE_MASK_V4 (RXS_8125_RSS_TCP_V4 | RXS_8125B_RSS_UDP_V4) +static void rtl8126_rx_hash_v3(struct rtl8126_private *tp, + struct RxDescV3 *descv3, + struct sk_buff *skb) { u16 rss_header_info; @@ -451,11 +508,46 @@ void rtl8126_rx_hash(struct rtl8126_private *tp, if (!(rss_header_info & RTL8126_RXS_RSS_L3_TYPE_MASK)) return; - skb_set_hash(skb, rtl8126_get_rx_desc_hash(tp, descv3), + skb_set_hash(skb, rtl8126_get_rx_desc_hash(tp, (struct RxDesc *)descv3), (RTL8126_RXS_RSS_L4_TYPE_MASK & rss_header_info) ? PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); } +static void rtl8126_rx_hash_v4(struct rtl8126_private *tp, + struct RxDescV4 *descv4, + struct sk_buff *skb) +{ + u32 rss_header_info; + + if (!(tp->dev->features & NETIF_F_RXHASH)) + return; + + rss_header_info = le32_to_cpu(descv4->RxDescNormalDDWord1.RSSInfo); + + if (!(rss_header_info & RTL8126_RXS_RSS_L3_TYPE_MASK_V4)) + return; + + skb_set_hash(skb, rtl8126_get_rx_desc_hash(tp, (struct RxDesc *)descv4), + (RTL8126_RXS_RSS_L4_TYPE_MASK_V4 & rss_header_info) ? + PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); +} + +void rtl8126_rx_hash(struct rtl8126_private *tp, + struct RxDesc *desc, + struct sk_buff *skb) +{ + switch (tp->InitRxDescType) { + case RX_DESC_RING_TYPE_3: + rtl8126_rx_hash_v3(tp, (struct RxDescV3 *)desc, skb); + break; + case RX_DESC_RING_TYPE_4: + rtl8126_rx_hash_v4(tp, (struct RxDescV4 *)desc, skb); + break; + default: + return; + } +} + void rtl8126_disable_rss(struct rtl8126_private *tp) { RTL_W32(tp, RSS_CTRL_8125, 0x00); diff --git a/r8126_rss.h b/r8126_rss.h index 0d6062d..6091f0b 100644 --- a/r8126_rss.h +++ b/r8126_rss.h @@ -47,18 +47,25 @@ enum rtl8126_rss_flag { }; struct rtl8126_private; +struct RxDesc; int rtl8126_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, u32 *rule_locs); 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); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) +int rtl8126_get_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh); +int rtl8126_set_rxfh(struct net_device *dev, struct ethtool_rxfh_param *rxfh, + struct netlink_ext_ack *extack); +#else int rtl8126_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc); int rtl8126_set_rxfh(struct net_device *netdev, const u32 *indir, const u8 *key, const u8 hfunc); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6,8,0) */ void rtl8126_rx_hash(struct rtl8126_private *tp, - struct RxDescV3 *descv3, + struct RxDesc *desc, struct sk_buff *skb); void _rtl8126_config_rss(struct rtl8126_private *tp); void rtl8126_config_rss(struct rtl8126_private *tp); diff --git a/rtl_eeprom.c b/rtl_eeprom.c index 6421df4..643dea6 100644 --- a/rtl_eeprom.c +++ b/rtl_eeprom.c @@ -93,7 +93,7 @@ void rtl8126_eeprom_cleanup(struct rtl8126_private *tp) rtl8126_lower_clock(tp, &x); } -int rtl8126_eeprom_cmd_done(struct rtl8126_private *tp) +static int rtl8126_eeprom_cmd_done(struct rtl8126_private *tp) { u8 x; int i; @@ -123,9 +123,8 @@ u16 rtl8126_eeprom_read_sc(struct rtl8126_private *tp, u16 reg) u8 x; u16 data; - if(tp->eeprom_type == EEPROM_TYPE_NONE) { + if(tp->eeprom_type == EEPROM_TYPE_NONE) return -1; - } if (tp->eeprom_type==EEPROM_TYPE_93C46) addr_sz = 6; @@ -157,9 +156,8 @@ void rtl8126_eeprom_write_sc(struct rtl8126_private *tp, u16 reg, u16 data) int addr_sz = 6; int w_dummy_addr = 4; - if(tp->eeprom_type == EEPROM_TYPE_NONE) { - return ; - } + if(tp->eeprom_type == EEPROM_TYPE_NONE) + return; if (tp->eeprom_type==EEPROM_TYPE_93C46) { addr_sz = 6; @@ -178,17 +176,15 @@ void rtl8126_eeprom_write_sc(struct rtl8126_private *tp, u16 reg, u16 data) 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) { + if (rtl8126_eeprom_cmd_done(tp) < 0) return; - } rtl8126_stand_by(tp); 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) { + if (rtl8126_eeprom_cmd_done(tp) < 0) return; - } rtl8126_stand_by(tp); rtl8126_shift_out_bits(tp, RTL_EEPROM_EWDS_OPCODE, 5); diff --git a/rtltool.c b/rtltool.c index c4b7d52..51d9b18 100644 --- a/rtltool.c +++ b/rtltool.c @@ -251,6 +251,31 @@ int rtl8126_tool_ioctl(struct rtl8126_private *tp, struct ifreq *ifr) rtl8126_mdio_prot_direct_write_phy_ocp(tp, my_cmd.offset, my_cmd.data); break; +#ifdef ENABLE_FIBER_SUPPORT + case RTL_READ_FIBER_PHY: + if (!HW_FIBER_STATUS_CONNECTED(tp)) { + ret = -EOPNOTSUPP; + break; + } + + my_cmd.data = rtl8126_fiber_mdio_read(tp, my_cmd.offset); + if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) { + ret = -EFAULT; + break; + } + + break; + + case RTL_WRITE_FIBER_PHY: + if (!HW_FIBER_STATUS_CONNECTED(tp)) { + ret = -EOPNOTSUPP; + break; + } + + rtl8126_fiber_mdio_write(tp, my_cmd.offset, my_cmd.data); + break; +#endif /* ENABLE_FIBER_SUPPORT */ + default: ret = -EOPNOTSUPP; break; diff --git a/rtltool.h b/rtltool.h index 1ae1b21..9eb929c 100644 --- a/rtltool.h +++ b/rtltool.h @@ -63,6 +63,9 @@ enum rtl_cmd { RTL_DIRECT_READ_PHY_OCP, RTL_DIRECT_WRITE_PHY_OCP, + RTL_READ_FIBER_PHY, + RTL_WRITE_FIBER_PHY, + RTLTOOL_INVALID };