32
32
#define NETNEXT_VERSION "12"
33
33
34
34
/* Information for net */
35
- #define NET_VERSION "11 "
35
+ #define NET_VERSION "12 "
36
36
37
37
#define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
38
38
#define DRIVER_AUTHOR "Realtek linux nic maintainers <
[email protected] >"
@@ -4016,6 +4016,11 @@ static void rtl_clear_bp(struct r8152 *tp, u16 type)
4016
4016
ocp_write_word (tp , type , PLA_BP_BA , 0 );
4017
4017
}
4018
4018
4019
+ static inline void rtl_reset_ocp_base (struct r8152 * tp )
4020
+ {
4021
+ tp -> ocp_base = -1 ;
4022
+ }
4023
+
4019
4024
static int rtl_phy_patch_request (struct r8152 * tp , bool request , bool wait )
4020
4025
{
4021
4026
u16 data , check ;
@@ -4087,8 +4092,6 @@ static int rtl_post_ram_code(struct r8152 *tp, u16 key_addr, bool wait)
4087
4092
4088
4093
rtl_phy_patch_request (tp , false, wait );
4089
4094
4090
- ocp_write_word (tp , MCU_TYPE_PLA , PLA_OCP_GPHY_BASE , tp -> ocp_base );
4091
-
4092
4095
return 0 ;
4093
4096
}
4094
4097
@@ -4800,6 +4803,8 @@ static void rtl_ram_code_speed_up(struct r8152 *tp, struct fw_phy_speed_up *phy,
4800
4803
u32 len ;
4801
4804
u8 * data ;
4802
4805
4806
+ rtl_reset_ocp_base (tp );
4807
+
4803
4808
if (sram_read (tp , SRAM_GPHY_FW_VER ) >= __le16_to_cpu (phy -> version )) {
4804
4809
dev_dbg (& tp -> intf -> dev , "PHY firmware has been the newest\n" );
4805
4810
return ;
@@ -4845,7 +4850,8 @@ static void rtl_ram_code_speed_up(struct r8152 *tp, struct fw_phy_speed_up *phy,
4845
4850
}
4846
4851
}
4847
4852
4848
- ocp_write_word (tp , MCU_TYPE_PLA , PLA_OCP_GPHY_BASE , tp -> ocp_base );
4853
+ rtl_reset_ocp_base (tp );
4854
+
4849
4855
rtl_phy_patch_request (tp , false, wait );
4850
4856
4851
4857
if (sram_read (tp , SRAM_GPHY_FW_VER ) == __le16_to_cpu (phy -> version ))
@@ -4861,6 +4867,8 @@ static int rtl8152_fw_phy_ver(struct r8152 *tp, struct fw_phy_ver *phy_ver)
4861
4867
ver_addr = __le16_to_cpu (phy_ver -> ver .addr );
4862
4868
ver = __le16_to_cpu (phy_ver -> ver .data );
4863
4869
4870
+ rtl_reset_ocp_base (tp );
4871
+
4864
4872
if (sram_read (tp , ver_addr ) >= ver ) {
4865
4873
dev_dbg (& tp -> intf -> dev , "PHY firmware has been the newest\n" );
4866
4874
return 0 ;
@@ -4877,6 +4885,8 @@ static void rtl8152_fw_phy_fixup(struct r8152 *tp, struct fw_phy_fixup *fix)
4877
4885
{
4878
4886
u16 addr , data ;
4879
4887
4888
+ rtl_reset_ocp_base (tp );
4889
+
4880
4890
addr = __le16_to_cpu (fix -> setting .addr );
4881
4891
data = ocp_reg_read (tp , addr );
4882
4892
@@ -4908,6 +4918,8 @@ static void rtl8152_fw_phy_union_apply(struct r8152 *tp, struct fw_phy_union *ph
4908
4918
u32 length ;
4909
4919
int i , num ;
4910
4920
4921
+ rtl_reset_ocp_base (tp );
4922
+
4911
4923
num = phy -> pre_num ;
4912
4924
for (i = 0 ; i < num ; i ++ )
4913
4925
sram_write (tp , __le16_to_cpu (phy -> pre_set [i ].addr ),
@@ -4938,6 +4950,8 @@ static void rtl8152_fw_phy_nc_apply(struct r8152 *tp, struct fw_phy_nc *phy)
4938
4950
u32 length , i , num ;
4939
4951
__le16 * data ;
4940
4952
4953
+ rtl_reset_ocp_base (tp );
4954
+
4941
4955
mode_reg = __le16_to_cpu (phy -> mode_reg );
4942
4956
sram_write (tp , mode_reg , __le16_to_cpu (phy -> mode_pre ));
4943
4957
sram_write (tp , __le16_to_cpu (phy -> ba_reg ),
@@ -5107,6 +5121,7 @@ static void rtl8152_apply_firmware(struct r8152 *tp, bool power_cut)
5107
5121
if (rtl_fw -> post_fw )
5108
5122
rtl_fw -> post_fw (tp );
5109
5123
5124
+ rtl_reset_ocp_base (tp );
5110
5125
strscpy (rtl_fw -> version , fw_hdr -> version , RTL_VER_SIZE );
5111
5126
dev_info (& tp -> intf -> dev , "load %s successfully\n" , rtl_fw -> version );
5112
5127
}
@@ -8484,6 +8499,8 @@ static int rtl8152_resume(struct usb_interface *intf)
8484
8499
8485
8500
mutex_lock (& tp -> control );
8486
8501
8502
+ rtl_reset_ocp_base (tp );
8503
+
8487
8504
if (test_bit (SELECTIVE_SUSPEND , & tp -> flags ))
8488
8505
ret = rtl8152_runtime_resume (tp );
8489
8506
else
@@ -8499,6 +8516,7 @@ static int rtl8152_reset_resume(struct usb_interface *intf)
8499
8516
struct r8152 * tp = usb_get_intfdata (intf );
8500
8517
8501
8518
clear_bit (SELECTIVE_SUSPEND , & tp -> flags );
8519
+ rtl_reset_ocp_base (tp );
8502
8520
tp -> rtl_ops .init (tp );
8503
8521
queue_delayed_work (system_long_wq , & tp -> hw_phy_work , 0 );
8504
8522
set_ethernet_addr (tp , true);
0 commit comments