mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 09:55:19 +02:00
r8152: fix the firmware doesn't work
[ Upstream commit8487b4af59
] generic_ocp_write() asks the parameter "size" must be 4 bytes align. Therefore, write the bp would fail, if the mac->bp_num is odd. Align the size to 4 for fixing it. The way may write an extra bp, but the rtl8152_is_fw_mac_ok() makes sure the value must be 0 for the bp whose index is more than mac->bp_num. That is, there is no influence for the firmware. Besides, I check the return value of generic_ocp_write() to make sure everything is correct. Fixes:e5c266a611
("r8152: set bp in bulk") Signed-off-by: Hayes Wang <hayeswang@realtek.com> Link: https://patch.msgid.link/20240903063333.4502-1-hayeswang@realtek.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1df42be305
commit
565eb51b3d
|
@ -5143,14 +5143,23 @@ static void rtl8152_fw_mac_apply(struct r8152 *tp, struct fw_mac *mac)
|
||||||
data = (u8 *)mac;
|
data = (u8 *)mac;
|
||||||
data += __le16_to_cpu(mac->fw_offset);
|
data += __le16_to_cpu(mac->fw_offset);
|
||||||
|
|
||||||
generic_ocp_write(tp, __le16_to_cpu(mac->fw_reg), 0xff, length, data,
|
if (generic_ocp_write(tp, __le16_to_cpu(mac->fw_reg), 0xff, length,
|
||||||
type);
|
data, type) < 0) {
|
||||||
|
dev_err(&tp->intf->dev, "Write %s fw fail\n",
|
||||||
|
type ? "PLA" : "USB");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ocp_write_word(tp, type, __le16_to_cpu(mac->bp_ba_addr),
|
ocp_write_word(tp, type, __le16_to_cpu(mac->bp_ba_addr),
|
||||||
__le16_to_cpu(mac->bp_ba_value));
|
__le16_to_cpu(mac->bp_ba_value));
|
||||||
|
|
||||||
generic_ocp_write(tp, __le16_to_cpu(mac->bp_start), BYTE_EN_DWORD,
|
if (generic_ocp_write(tp, __le16_to_cpu(mac->bp_start), BYTE_EN_DWORD,
|
||||||
__le16_to_cpu(mac->bp_num) << 1, mac->bp, type);
|
ALIGN(__le16_to_cpu(mac->bp_num) << 1, 4),
|
||||||
|
mac->bp, type) < 0) {
|
||||||
|
dev_err(&tp->intf->dev, "Write %s bp fail\n",
|
||||||
|
type ? "PLA" : "USB");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bp_en_addr = __le16_to_cpu(mac->bp_en_addr);
|
bp_en_addr = __le16_to_cpu(mac->bp_en_addr);
|
||||||
if (bp_en_addr)
|
if (bp_en_addr)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user