Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2024 Realtek Corporation. All rights reserved 3 : : */ 4 : : 5 : : #include "../r8169_ethdev.h" 6 : : #include "../r8169_hw.h" 7 : : #include "../r8169_phy.h" 8 : : #include "rtl8125cp_mcu.h" 9 : : 10 : : /* For RTL8125CP, CFG_METHOD_58 */ 11 : : 12 : : static void 13 : 0 : hw_init_rxcfg_8125cp(struct rtl_hw *hw) 14 : : { 15 : 0 : RTL_W32(hw, RxConfig, Rx_Fetch_Number_8 | Rx_Close_Multiple | 16 : : RxCfg_pause_slot_en | (RX_DMA_BURST_256 << RxCfgDMAShift)); 17 : 0 : } 18 : : 19 : : static void 20 : 0 : hw_ephy_config_8125cp(struct rtl_hw *hw) 21 : : { 22 : : switch (hw->mcfg) { 23 : : case CFG_METHOD_58: 24 : : /* nothing to do */ 25 : : break; 26 : : } 27 : 0 : } 28 : : 29 : : static void 30 : 0 : rtl_hw_phy_config_8125cp_1(struct rtl_hw *hw) 31 : : { 32 : 0 : rtl_set_eth_phy_ocp_bit(hw, 0xA442, BIT_11); 33 : : 34 : 0 : rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xad0e, 0x007F, 0x000B); 35 : 0 : rtl_set_eth_phy_ocp_bit(hw, 0xad78, BIT_4); 36 : 0 : } 37 : : 38 : : static void 39 : 0 : hw_phy_config_8125cp(struct rtl_hw *hw) 40 : : { 41 [ # # ]: 0 : switch (hw->mcfg) { 42 : 0 : case CFG_METHOD_58: 43 : 0 : rtl_hw_phy_config_8125cp_1(hw); 44 : 0 : break; 45 : : } 46 : 0 : } 47 : : 48 : : static void 49 : 0 : hw_mac_mcu_config_8125cp(struct rtl_hw *hw) 50 : : { 51 [ # # ]: 0 : if (hw->NotWrMcuPatchCode) 52 : : return; 53 : : 54 : 0 : rtl_hw_disable_mac_mcu_bps(hw); 55 : : } 56 : : 57 : : static void 58 : 0 : hw_phy_mcu_config_8125cp(struct rtl_hw *hw) 59 : : { 60 [ # # ]: 0 : switch (hw->mcfg) { 61 : 0 : case CFG_METHOD_58: 62 : 0 : rtl_set_phy_mcu_8125cp_1(hw); 63 : 0 : break; 64 : : } 65 : 0 : } 66 : : 67 : : const struct rtl_hw_ops rtl8125cp_ops = { 68 : : .hw_init_rxcfg = hw_init_rxcfg_8125cp, 69 : : .hw_ephy_config = hw_ephy_config_8125cp, 70 : : .hw_phy_config = hw_phy_config_8125cp, 71 : : .hw_mac_mcu_config = hw_mac_mcu_config_8125cp, 72 : : .hw_phy_mcu_config = hw_phy_mcu_config_8125cp, 73 : : };