--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
-@@ -975,8 +975,60 @@ enum rtl8152_fw_flags {
+@@ -974,8 +974,60 @@ enum rtl8152_fw_flags {
FW_FLAGS_START,
FW_FLAGS_STOP,
FW_FLAGS_NC,
/**
* struct fw_mac - a firmware block used by RTL_FW_PLA and RTL_FW_USB.
* The layout of the firmware block is:
-@@ -1081,6 +1133,15 @@ enum rtl_fw_type {
+@@ -1080,6 +1132,15 @@ enum rtl_fw_type {
RTL_FW_PHY_START,
RTL_FW_PHY_STOP,
RTL_FW_PHY_NC,
};
enum rtl_version {
-@@ -4000,6 +4061,162 @@ static int rtl_post_ram_code(struct r815
+@@ -3999,6 +4060,162 @@ static int rtl_post_ram_code(struct r815
return 0;
}
static bool rtl8152_is_fw_phy_nc_ok(struct r8152 *tp, struct fw_phy_nc *phy)
{
u32 length;
-@@ -4320,6 +4537,10 @@ static long rtl8152_check_firmware(struc
+@@ -4319,6 +4536,10 @@ static long rtl8152_check_firmware(struc
case RTL_FW_PHY_START:
if (test_bit(FW_FLAGS_START, &fw_flags) ||
test_bit(FW_FLAGS_NC, &fw_flags) ||
test_bit(FW_FLAGS_STOP, &fw_flags)) {
dev_err(&tp->intf->dev,
"check PHY_START fail\n");
-@@ -4368,7 +4589,153 @@ static long rtl8152_check_firmware(struc
+@@ -4367,7 +4588,153 @@ static long rtl8152_check_firmware(struc
goto fail;
}
__set_bit(FW_FLAGS_NC, &fw_flags);
break;
default:
dev_warn(&tp->intf->dev, "Unknown type %u is found\n",
-@@ -4391,6 +4758,143 @@ fail:
+@@ -4390,6 +4757,143 @@ fail:
return ret;
}
static void rtl8152_fw_phy_nc_apply(struct r8152 *tp, struct fw_phy_nc *phy)
{
u16 mode_reg, bp_index;
-@@ -4444,6 +4948,12 @@ static void rtl8152_fw_mac_apply(struct
+@@ -4443,6 +4947,12 @@ static void rtl8152_fw_mac_apply(struct
return;
}
rtl_clear_bp(tp, type);
/* Enable backup/restore of MACDBG. This is required after clearing PLA
-@@ -4479,7 +4989,6 @@ static void rtl8152_fw_mac_apply(struct
+@@ -4478,7 +4988,6 @@ static void rtl8152_fw_mac_apply(struct
ocp_write_word(tp, type, bp_en_addr,
__le16_to_cpu(mac->bp_en_value));
if (fw_ver_reg)
ocp_write_byte(tp, MCU_TYPE_USB, fw_ver_reg,
mac->fw_ver_data);
-@@ -4494,7 +5003,7 @@ static void rtl8152_apply_firmware(struc
+@@ -4493,7 +5002,7 @@ static void rtl8152_apply_firmware(struc
struct fw_header *fw_hdr;
struct fw_phy_patch_key *key;
u16 key_addr = 0;
if (IS_ERR_OR_NULL(rtl_fw->fw))
return;
-@@ -4516,17 +5025,40 @@ static void rtl8152_apply_firmware(struc
+@@ -4515,17 +5024,40 @@ static void rtl8152_apply_firmware(struc
rtl8152_fw_mac_apply(tp, (struct fw_mac *)block);
break;
case RTL_FW_PHY_START:
default:
break;
}
-@@ -5034,6 +5566,21 @@ static int r8153c_post_firmware_1(struct
+@@ -5033,6 +5565,21 @@ static int r8153c_post_firmware_1(struct
return 0;
}
static void r8153_aldps_en(struct r8152 *tp, bool enable)
{
u16 data;
-@@ -8674,12 +9221,16 @@ static int rtl_ops_init(struct r8152 *tp
+@@ -8651,12 +9198,16 @@ static int rtl_ops_init(struct r8152 *tp
#define FIRMWARE_8153A_4 "rtl_nic/rtl8153a-4.fw"
#define FIRMWARE_8153B_2 "rtl_nic/rtl8153b-2.fw"
#define FIRMWARE_8153C_1 "rtl_nic/rtl8153c-1.fw"
static int rtl_fw_init(struct r8152 *tp)
{
-@@ -8705,6 +9256,14 @@ static int rtl_fw_init(struct r8152 *tp)
+@@ -8682,6 +9233,14 @@ static int rtl_fw_init(struct r8152 *tp)
rtl_fw->pre_fw = r8153b_pre_firmware_1;
rtl_fw->post_fw = r8153b_post_firmware_1;
break;