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 "rtl9151a.h" 9 : : 10 : : /* For RTL9151A, CFG_METHOD_60 */ 11 : : 12 : : static void 13 : 0 : hw_init_rxcfg_9151a(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_512 << RxCfgDMAShift)); 17 : 0 : } 18 : : 19 : : static void 20 : 0 : hw_ephy_config_9151a(struct rtl_hw *hw) 21 : : { 22 : : switch (hw->mcfg) { 23 : : case CFG_METHOD_60: 24 : : /* nothing to do */ 25 : : break; 26 : : } 27 : 0 : } 28 : : 29 : : static void 30 : 0 : rtl_hw_phy_config_9151a_1(struct rtl_hw *hw) 31 : : { 32 : 0 : rtl_set_eth_phy_ocp_bit(hw, 0xA442, BIT_11); 33 : : 34 : 0 : rtl_mdio_direct_write_phy_ocp(hw, 0xB87C, 0x8079); 35 : 0 : rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xB87E, 0xFF00, 0x4400); 36 : 0 : rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xAC16, 0x00FF, 0x0001); 37 : 0 : rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xAD0E, 0x007F, 0x000D); 38 : : 39 : 0 : rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x80B6); 40 : 0 : rtl_mdio_direct_write_phy_ocp(hw, 0xA438, 0xB6C3); 41 : 0 : } 42 : : 43 : : static void 44 : 0 : hw_phy_config_9151a(struct rtl_hw *hw) 45 : : { 46 [ # # ]: 0 : switch (hw->mcfg) { 47 : 0 : case CFG_METHOD_60: 48 : 0 : rtl_hw_phy_config_9151a_1(hw); 49 : 0 : break; 50 : : } 51 : 0 : } 52 : : 53 : : static void 54 : 0 : hw_mac_mcu_config_9151a(struct rtl_hw *hw) 55 : : { 56 [ # # ]: 0 : if (hw->NotWrMcuPatchCode) 57 : : return; 58 : : 59 : 0 : rtl_hw_disable_mac_mcu_bps(hw); 60 : : 61 : : /* Get H/W mac mcu patch code version */ 62 : 0 : hw->hw_mcu_patch_code_ver = rtl_get_hw_mcu_patch_code_ver(hw); 63 : : 64 : : switch (hw->mcfg) { 65 : : case CFG_METHOD_60: 66 : : /* no mac mcu patch code */ 67 : : break; 68 : : } 69 : : } 70 : : 71 : : static void 72 : 0 : hw_phy_mcu_config_9151a(struct rtl_hw *hw) 73 : : { 74 [ # # ]: 0 : switch (hw->mcfg) { 75 : 0 : case CFG_METHOD_60: 76 : 0 : rtl_set_phy_mcu_9151a_1(hw); 77 : 0 : break; 78 : : } 79 : 0 : } 80 : : 81 : : const struct rtl_hw_ops rtl9151a_ops = { 82 : : .hw_init_rxcfg = hw_init_rxcfg_9151a, 83 : : .hw_ephy_config = hw_ephy_config_9151a, 84 : : .hw_phy_config = hw_phy_config_9151a, 85 : : .hw_mac_mcu_config = hw_mac_mcu_config_9151a, 86 : : .hw_phy_mcu_config = hw_phy_mcu_config_9151a, 87 : : };