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 : :
42 : 0 : rtl_set_phy_mcu_patch_request(hw);
43 : :
44 : 0 : rtl_set_eth_phy_ocp_bit(hw, 0xA466, BIT_1);
45 : 0 : rtl_mdio_direct_write_phy_ocp(hw, 0xA436, 0x837C);
46 : 0 : rtl_clear_eth_phy_ocp_bit(hw, 0xA438, BIT_14);
47 : :
48 : 0 : rtl_clear_phy_mcu_patch_request(hw);
49 : 0 : }
50 : :
51 : : static void
52 : 0 : hw_phy_config_9151a(struct rtl_hw *hw)
53 : : {
54 [ # # ]: 0 : switch (hw->mcfg) {
55 : 0 : case CFG_METHOD_60:
56 : 0 : rtl_hw_phy_config_9151a_1(hw);
57 : 0 : break;
58 : : }
59 : 0 : }
60 : :
61 : : static void
62 : 0 : hw_mac_mcu_config_9151a(struct rtl_hw *hw)
63 : : {
64 [ # # ]: 0 : if (hw->NotWrMcuPatchCode)
65 : : return;
66 : :
67 : 0 : rtl_hw_disable_mac_mcu_bps(hw);
68 : :
69 : : /* Get H/W mac mcu patch code version */
70 : 0 : hw->hw_mcu_patch_code_ver = rtl_get_hw_mcu_patch_code_ver(hw);
71 : :
72 : : switch (hw->mcfg) {
73 : : case CFG_METHOD_60:
74 : : /* no mac mcu patch code */
75 : : break;
76 : : }
77 : : }
78 : :
79 : : static void
80 : 0 : hw_phy_mcu_config_9151a(struct rtl_hw *hw)
81 : : {
82 [ # # ]: 0 : switch (hw->mcfg) {
83 : 0 : case CFG_METHOD_60:
84 : 0 : rtl_set_phy_mcu_9151a_1(hw);
85 : 0 : break;
86 : : }
87 : 0 : }
88 : :
89 : : const struct rtl_hw_ops rtl9151a_ops = {
90 : : .hw_init_rxcfg = hw_init_rxcfg_9151a,
91 : : .hw_ephy_config = hw_ephy_config_9151a,
92 : : .hw_phy_config = hw_phy_config_9151a,
93 : : .hw_mac_mcu_config = hw_mac_mcu_config_9151a,
94 : : .hw_phy_mcu_config = hw_phy_mcu_config_9151a,
95 : : };
|