LCOV - code coverage report
Current view: top level - drivers/net/r8169/base - rtl8125bp.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 52 0.0 %
Date: 2025-03-01 20:23:48 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 10 0.0 %

           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 "rtl8125bp_mcu.h"
       9                 :            : 
      10                 :            : /* For RTL8125BP, CFG_METHOD_54,55 */
      11                 :            : 
      12                 :            : static void
      13                 :          0 : hw_init_rxcfg_8125bp(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_8125bp(struct rtl_hw *hw)
      21                 :            : {
      22                 :            :         switch (hw->mcfg) {
      23                 :            :         case CFG_METHOD_54:
      24                 :            :         case CFG_METHOD_55:
      25                 :            :                 /* Nothing to do */
      26                 :            :                 break;
      27                 :            :         }
      28                 :          0 : }
      29                 :            : 
      30                 :            : static void
      31                 :          0 : rtl_hw_phy_config_8125bp_1(struct rtl_hw *hw)
      32                 :            : {
      33                 :          0 :         rtl_set_eth_phy_ocp_bit(hw, 0xA442, BIT_11);
      34                 :            : 
      35                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xA80C, BIT_14,
      36                 :            :                                           (BIT_15 | BIT_11 | BIT_10));
      37                 :            : 
      38                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x8010);
      39                 :          0 :         rtl_clear_eth_phy_ocp_bit(hw, 0xA438, BIT_11);
      40                 :            : 
      41                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xB87C, 0x8088);
      42                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xB87E, 0xFF00, 0x9000);
      43                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xB87C, 0x808F);
      44                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xB87E, 0xFF00, 0x9000);
      45                 :            : 
      46                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x8174);
      47                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xA438, BIT_13, (BIT_12 | BIT_11));
      48                 :          0 : }
      49                 :            : 
      50                 :            : static void
      51                 :          0 : rtl_hw_phy_config_8125bp_2(struct rtl_hw *hw)
      52                 :            : {
      53                 :          0 :         rtl_set_eth_phy_ocp_bit(hw, 0xA442, BIT_11);
      54                 :            : 
      55                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x8010);
      56                 :          0 :         rtl_clear_eth_phy_ocp_bit(hw, 0xA438, BIT_11);
      57                 :            : 
      58                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xB87C, 0x8088);
      59                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xB87E, 0xFF00, 0x9000);
      60                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xB87C, 0x808F);
      61                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xB87E, 0xFF00, 0x9000);
      62                 :            : 
      63                 :          0 :         rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x8174);
      64                 :          0 :         rtl_clear_and_set_eth_phy_ocp_bit(hw, 0xA438, BIT_13, (BIT_12 | BIT_11));
      65                 :          0 : }
      66                 :            : 
      67                 :            : static void
      68                 :          0 : hw_phy_config_8125bp(struct rtl_hw *hw)
      69                 :            : {
      70      [ #  #  # ]:          0 :         switch (hw->mcfg) {
      71                 :          0 :         case CFG_METHOD_54:
      72                 :          0 :                 rtl_hw_phy_config_8125bp_1(hw);
      73                 :          0 :                 break;
      74                 :          0 :         case CFG_METHOD_55:
      75                 :          0 :                 rtl_hw_phy_config_8125bp_2(hw);
      76                 :          0 :                 break;
      77                 :            :         }
      78                 :          0 : }
      79                 :            : 
      80                 :            : static void
      81                 :          0 : hw_mac_mcu_config_8125bp(struct rtl_hw *hw)
      82                 :            : {
      83         [ #  # ]:          0 :         if (hw->NotWrMcuPatchCode)
      84                 :            :                 return;
      85                 :            : 
      86      [ #  #  # ]:          0 :         switch (hw->mcfg) {
      87                 :          0 :         case CFG_METHOD_54:
      88                 :          0 :                 rtl_set_mac_mcu_8125bp_1(hw);
      89                 :          0 :                 break;
      90                 :          0 :         case CFG_METHOD_55:
      91                 :          0 :                 rtl_set_mac_mcu_8125bp_2(hw);
      92                 :          0 :                 break;
      93                 :            :         }
      94                 :            : }
      95                 :            : 
      96                 :            : static void
      97                 :          0 : hw_phy_mcu_config_8125bp(struct rtl_hw *hw)
      98                 :            : {
      99         [ #  # ]:          0 :         switch (hw->mcfg) {
     100                 :          0 :         case CFG_METHOD_54:
     101                 :          0 :                 rtl_set_phy_mcu_8125bp_1(hw);
     102                 :          0 :                 break;
     103                 :            :         case CFG_METHOD_55:
     104                 :            :                 /* Nothing to do */
     105                 :            :                 break;
     106                 :            :         }
     107                 :          0 : }
     108                 :            : 
     109                 :            : const struct rtl_hw_ops rtl8125bp_ops = {
     110                 :            :         .hw_init_rxcfg     = hw_init_rxcfg_8125bp,
     111                 :            :         .hw_ephy_config    = hw_ephy_config_8125bp,
     112                 :            :         .hw_phy_config     = hw_phy_config_8125bp,
     113                 :            :         .hw_mac_mcu_config = hw_mac_mcu_config_8125bp,
     114                 :            :         .hw_phy_mcu_config = hw_phy_mcu_config_8125bp,
     115                 :            : };

Generated by: LCOV version 1.14